wolfie78uk
Programmer
I was trying to block all keyboard and mouse input whilst running my VB application but was unable to do so with the API functions in VB.
This may be a horribly long winded way to do it (and I leave myself open to the mockery of the experienced programmers) but it works.
1)Open up Visual C++ and create a new Empty Win32DLL Project called BlockInput.
2)Add a C++ file (with a .cpp extension) to your project - call it "BlockInput.cpp"
In the .cpp file write :
void _stdcall BlockInput(bool State)
{
if (State == True)
BlockInput(True);
else
BlockInput(False);
};
3) Add a define file to your project(select a text file and call it "BlockInput.def"
In the .def file write :
LIBRARY BlockInput
EXPORTS
BlockInput @1
4) Build the project and BlockInput.DLL will be created probably in the MSVisualStudio/MyProjects/)
directory.
5) Copy the DLL into WINNT/System32.
6) In your VB Module decalre the following :
Declare Sub BlockInput Lib "BlockInput.dll" (ByVal State As Boolean)
7) Now you can use it :
call BlockInput(True) 'Blocks Input
call BlockInput(False) 'Allows input
I hope somebody finds this useful.
Oh, and if anybody wants the DLL let me know.
This may be a horribly long winded way to do it (and I leave myself open to the mockery of the experienced programmers) but it works.
1)Open up Visual C++ and create a new Empty Win32DLL Project called BlockInput.
2)Add a C++ file (with a .cpp extension) to your project - call it "BlockInput.cpp"
In the .cpp file write :
void _stdcall BlockInput(bool State)
{
if (State == True)
BlockInput(True);
else
BlockInput(False);
};
3) Add a define file to your project(select a text file and call it "BlockInput.def"
In the .def file write :
LIBRARY BlockInput
EXPORTS
BlockInput @1
4) Build the project and BlockInput.DLL will be created probably in the MSVisualStudio/MyProjects/)
directory.
5) Copy the DLL into WINNT/System32.
6) In your VB Module decalre the following :
Declare Sub BlockInput Lib "BlockInput.dll" (ByVal State As Boolean)
7) Now you can use it :
call BlockInput(True) 'Blocks Input
call BlockInput(False) 'Allows input
I hope somebody finds this useful.
Oh, and if anybody wants the DLL let me know.