You cannot do that using VB. If you want to install a global hook using SetWindowsHookEx, your hook procedure must be in a DLL while VB6 cannot be used to make normal DLLs. This fact is documented in the following article.(mouse hook and keyboard hook are similar) Q177992 HOWTO: Intercept Keyboard Input from Visual Basic http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q177992 ================= It is possible to intercept all of the keyboard input from all of the applications running on a system, but not using "pure" Visual Basic. The hook must be placed in a standard DLL; while Visual Basic can create OLE DLLs, it cannot create standard DLLs. ================= You need use a tool which can be used to make standard DLLs to write the hook procedure, such as VC. Global hooks are not supported in the .NET Framework You cannot implement global hooks in Microsoft .NET Framework. To install a global hook, a hook must have a native DLL export to insert itself in another process that requires a valid, consistent function to call into. This behavior requires a DLL export. The .NET Framework does not support DLL exports. Managed code has no concept of a consistent value for a function pointer because these function pointers are proxies that are built dynamically.
如果只屏蔽自身程序的F9 - F12,就好弄些啦,如果想屏蔽整个系统下的F9 - F12,就必须再写一个简单的动态链接库(DLL),因为操作系统的内存管理机制问题,有些功能只能在DLL里才能实现。
SetWindowsHookEx, your hook procedure must be in a DLL while VB6 cannot be
used to make normal DLLs. This fact is documented in the following
article.(mouse hook and keyboard hook are similar) Q177992 HOWTO: Intercept Keyboard Input from Visual Basic
http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q177992
=================
It is possible to intercept all of the keyboard input from all of the
applications running on a system, but not using "pure" Visual Basic. The
hook must be placed in a standard DLL; while Visual Basic can create OLE
DLLs, it cannot create standard DLLs.
=================
You need use a tool which can be used to make standard DLLs to write the
hook procedure, such as VC. Global hooks are not supported in the .NET Framework
You cannot implement global hooks in Microsoft .NET Framework. To install a global hook, a hook must have a native DLL export to insert itself in another process that requires a valid, consistent function to call into. This behavior requires a DLL export. The .NET Framework does not support DLL exports. Managed code has no concept of a consistent value for a function pointer because these function pointers are proxies that are built dynamically.
如果只屏蔽自身程序的F9 - F12,就好弄些啦,如果想屏蔽整个系统下的F9 - F12,就必须再写一个简单的动态链接库(DLL),因为操作系统的内存管理机制问题,有些功能只能在DLL里才能实现。
------------------
同意一楼的观点!
有没有类似的代码给我看一下