473,395 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to block keys on the keyboard using following source code?

1
Good the other day I passed this source that supposedly serves to lock the keys on the keyboard ( in this case only blocks F1) .

The problem is that it does not work , I got tired of trying different configurations (from google ) but nothing , it is business as simepre .

Someone could help me to know that keys are not locked?


Source :

Expand|Select|Wrap|Line Numbers
  1. HHOOK g_hHookKbdLL = NULL;
  2. LRESULT CALLBACK KeyHookLL(int nCode, WPARAM wp, LPARAM lp);
  3.  
  4. BOOL APIENTRY DllMain(HINSTANCE hModule,
  5. DWORD ul_reason_for_call,
  6. LPVOID lpReserved
  7. )
  8. {
  9.  
  10.  
  11. switch (ul_reason_for_call)
  12. {
  13. case DLL_PROCESS_ATTACH:
  14. g_hHookKbdLL = SetWindowsHookEx(WH_KEYBOARD_LL,KeyHookLL, hModule, 0);
  15. break;
  16. case DLL_THREAD_ATTACH:
  17. break;
  18. case DLL_THREAD_DETACH:
  19. break;
  20. case DLL_PROCESS_DETACH:
  21. UnhookWindowsHookEx(g_hHookKbdLL);
  22. g_hHookKbdLL = NULL;
  23. break;
  24. }
  25. return TRUE;
  26. }
  27.  
  28.  
  29. LRESULT CALLBACK KeyHookLL(int nCode, WPARAM wp, LPARAM lp)
  30. {
  31. KBDLLHOOKSTRUCT *pkh = (KBDLLHOOKSTRUCT *) lp;
  32.  
  33. if (nCode==HC_ACTION)
  34. {
  35. if(pkh->vkCode==VK_F1) // Bloquear F1
  36. {
  37. return 1;
  38. }
  39. }
  40. return CallNextHookEx(g_hHookKbdLL, nCode, wp, lp);
PD : supposedly to block only needs to be changed : if ( PKH - > vkCode == VK_F1 ) / / Block F1 x if ( PKH - > vkCode == VK_F2 ) / / Block F2 and so on.

Sorry for my language , I'm from Argentina.
Feb 28 '11 #1
1 2577
Banfa
9,065 Expert Mod 8TB
You do realise that you will need to run an application that uses this DLL before any effects from it would take effect?
Feb 28 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: | last post by:
hi everyone, i was hoping someone could help me. the code below - in IE the menu options (text) are a couple of pixels too low and i cant move them up, and the form boxes are ok. in mozilla the...
3
by: RWC | last post by:
Hello, I have an issue that's driving me batty! I have a report, whose record source is SQL based on a normalized set of tables. There are no nested queries and no dlookups in this record...
3
by: Paul T. Rong | last post by:
there is a form "order" which includes a subform "order_detail", and a checkbox called "save" in the form "order". what I want to do is when I click "save", the "order_detail" subform will be...
0
by: Andrew Dowding | last post by:
Hi Everybody, I have been looking at problems with my Windows Forms C# application and it's little Jet 4 (Access) database for the last few days. The Windows Forms app implements a facade and...
1
by: P. Prosper | last post by:
I need some help on this issue. I am trying to lock the application object from within a vb class but I'll get the following error: Exception Details: System.NullReferenceException: Object...
190
by: blangela | last post by:
If you had asked me 5 years ago about the future of C++, I would have told you that its future was assured for many years to come. Recently, I have been starting to wonder. I have been teaching...
0
by: cwho.work | last post by:
Hi! We are using apache ibatis with our MySQL 5.0 database (using innodb tables), in our web application running on Tomcat 5. Recently we started getting a number of errors relating to...
13
by: Lyon | last post by:
Hi everyone: I have 20 threads and each creats a file in the same directory, respectively. However, because the threads are not synchronized, and only some of the 20 threads creat the file in...
1
by: =?Utf-8?B?Y2hhc2ds?= | last post by:
MSDN is set as the help source for Visual Studio 6.0. When I open help the left panel, navigation, works OK. But as soon as I select a topic the right plaincomplaints about not finding the topic...
1
by: Arif Mohammed | last post by:
Hi, iam using MySql 4.0.1 and jboss-4.0.4.GA Iam getting the following exception when there are more concurrent requests more than 50 in a second Caused by: org.xyz.MyClass: SQL...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.