windows key disable DLL, how to pass parameters?
BlitzPlus Forums/BlitzPlus Programming/windows key disable DLL, how to pass parameters?
| ||
Hey y'all! I have found a freeware DLL for disabling/enabling the Windows key! (and it does more). You can download it on http://chorus.inav.net/~bjackson/WKKRedst.zip Now I know I can call a DLL, but I don't have a clue on how I should call the exact function. The docs say this: KILL_WINKEY = 0x0001; // Disable the Windows Key KILL_CTRLESC = 0x0002; // Disable the Ctrl+Esc key combination KILL_COMBOS = 0x0004; // Disable all WinKey combinations like WinKey+E // for Explorer and WinKey+F for Find KILL_CONTEXT = 0x0008; // Disable the context menu key KILL_SYSKEYS = 0x0010; // Disable all system keys including the Windows // Key and all WinKey combinations, Ctrl+Alt+Del, // Alt+Tab, Ctrl+Esc and Alt+Esc. This option // does not work on Windows NT. Passing 0 (zero) to the Kill function re-enables all keys that were disabled. Calling convention: I have provided DLLs with __stdcall, __cdecl and __fastcall calling conventions. Depending on the programming language and/or compiler you are using, you can use the DLL with the appropriate type. The DLLs are otherwise identical. Can someone shine a light on this, coz I am out of ideas. Especially on parameter passing using pokeInt and createBank. I could eventually turn it into a blitzBasic command set: SetWindowsKey 0 ;off SetWindowsKey 1 ;on Thank you. UPDATE: The maker of this proggy explained me the above are hexidecimal values and they act as flags. I should pass an int. But, no succes...: inBank=CreateBank(4) PokeInt inBank,0,0001 result=CallDLL( "userlibs\WKeyKill.dll","Kill",inBank ) FreeBank inBank While Not KeyHit(1) Wend End |
| ||
A) CallDLL is not used any more. That's the old poopy way to do it. (Poopy is the technical term for it). B) Create a .decls file and put it in your userlibs directory. It should look somewhat like the following. .lib "WKeyKill.dll" Kill(flag%):Kill C) Then you can call the dll routine as if it was a regular blitz command. flags% = 1 Kill(flags) |
| ||
Just be sure to use the "standard calling" version of such DLL. CallDLL() can handle C standard, but UserLibs declared commands can't. Try this (saved like WKeyKill.decls in the UserLibs folder): .lib "WKeyKill.dll" Kill(flag%):"_Kill@4" With UserLibs you MUST use the standard calling version. PS: Note that such DLL could slow your applications, as it installs an input hook to process any key pressing before the system itself. See documentation for SystemParametersInfo() API call and do it yourself. |
| ||
YAY Seldon! That worked! It's now: setWindowsKeys 0 I use Blitz3d, so I can't do an API call. The author claims to be an exception to other programmers which use slow and bloated libraries. Let's hope so :P |
| ||
You're welcome. Ehi, you CAN do API calls in Blitz3D !!! Just like you can call a 3rd-party DLL, you can do a call to a system (Win API) DLL. :) |