Cool-LV Posted June 14, 2006 Report Share Posted June 14, 2006 As my subject, how to disable/restore keyboard or a mouse function ? and I know using User32.dll a "blockinput" function can block all of inputs, but this is not my goal, since I use send key function, namely, program auto inputs characters to the other application (not labVIEW application, so discard event function can't achieve this goal, have to use API ) instead of manual, and I want to disable keyboard and mouse function to avoid people inputting before program is doing auto sendkey process. and "blockinput" function would block every inputs too, program sends key fail, anybody can help would be great appreciation ! :worship: Quote Link to comment
JDave Posted June 15, 2006 Report Share Posted June 15, 2006 As my subject, how to disable/restore keyboard or a mouse function ? and I know using User32.dll a "blockinput" function can block all of inputs, but this is not my goal, since I use send key function, namely, program auto inputs characters to the other application (not labVIEW application, so discard event function can't achieve this goal, have to use API ) instead of manual, and I want to disable keyboard and mouse function to avoid people inputting before program is doing auto sendkey process. and "blockinput" function would block every inputs too, program sends key fail, anybody can help would be great appreciation ! :worship: I am unsure of what you are asking. If I am correct, the LabVIEW app is sending information to the other application via the API send key functionality. The LabVIEW app is frontmost, thus capturing key/mouse input. At some point the LabVIEW app will be sending information over to the other app, and you want to avoid anything happening while this occurs. But since your method of communication is through sending keyboard data, you are stuck. You can ignore keyboard and mouse events in your labview program by either discarding them with Filter? events are by treating them differently based on some flag set in your program. You can also have your code for the sendkey called within an event structure, which by default locks the Front Panel from keyboard and mouse until the event is done being serviced. This may be what you are asking. If you want to prevent the user from changing focus from your LabVIEW app to another app or Windows toolbar, etc. then I have nothing to offer. David Quote Link to comment
Cool-LV Posted June 15, 2006 Author Report Share Posted June 15, 2006 I am unsure of what you are asking. If I am correct, the LabVIEW app is sending information to the other application via the API send key functionality. The LabVIEW app is frontmost,(no , labVIEW app can do this step with minimized window) thus capturing key/mouse input. At some point the LabVIEW app will be sending information over to the other app, and you want to avoid anything happening while this occurs. But since your method of communication is through sending keyboard data, you are stuck.You can ignore keyboard and mouse events in your labview program by either discarding them with Filter? events are by treating them differently based on some flag set in your program. You can also have your code for the sendkey called within an event structure, which by default locks the Front Panel from keyboard and mouse until the event is done being serviced. This may be what you are asking. (no, I can't lock the front panel, because, if you do this, how can you send the key to the other appliction ?) If you want to prevent the user from changing focus from your LabVIEW app to another app or Windows toolbar, etc. then I have nothing to offer. David Thanks ! OK, for details, let me tell a sample I want to program a function, it can help me to input user name and password, and this input field is from a web, cause this web that I am using frequently, and I don't want to input it manual, my goal is that open a labVIEW app(it can store my user name and password), and click a button, then program helps to input "user name and password, within program inputting time, for prevent people to move mouse or click keyboard, so I want to disable them " , am I clear ? Quote Link to comment
JDave Posted June 15, 2006 Report Share Posted June 15, 2006 Thanks ! OK, for details, let me tell a sampleI want to program a function, it can help me to input user name and password, and this input field is from a web, cause this web that I am using frequently, and I don't want to input it manual, my goal is that open a labVIEW app(it can store my user name and password), and click a button, then program helps to input "user name and password, within program inputting time, for prevent people to move mouse or click keyboard, so I want to disable them " , am I clear ? It seems that the time to write a user name and password would be very short. You may not have much of an issue there. In summary, you CAN lock the LabVIEW panel because the code sending the name&password would be running in the event structure. You said these would be stored, so there would be no interaction on the panel. Look into event structures if you aren't familiar with them. You cannot lock the user from clicking on things on the web browser (as far as I know) based on your limitations. Quote Link to comment
Cool-LV Posted June 15, 2006 Author Report Share Posted June 15, 2006 It seems that the time to write a user name and password would be very short. You may not have much of an issue there. ( man, that is for example, not details, I am facing much field wanting to do sendkey action actually) In summary, you CAN lock the LabVIEW panel because the code sending the name&password would be running in the event structure. (OK, if some people click the mouse, or open the other application during the program doning sendkey process ? what would happen ? the key focus will be gone. or the active window would be changed.) You said these would be stored, (my store-- means that I can store the password and user name or any other informations to *.ini or *.xml file, and as I open the "sendkey application" it can load the config, then takes the sendkey action ) so there would be no interaction on the panel. (yes, you are right) Look into event structures if you aren't familiar with them. (en....would you kindly help to make a simpel sample for me ? with this status ?!) You cannot lock the user from clicking on things on the web browser (as far as I know) based on your limitations. actually, I viewed a application can do my issues ago, I remember that software is downloaded from some website, as I doubled click it to install, that application prompts a dialog box to ask people input CD key, and I found at that time, keyboard and mouse were disabled, and can see the CD key was inputted automatically by its software, after finished input CD key, the mouse and keyboard's function were restored ,I don't know how it did. Quote Link to comment
Rolf Kalbermatter Posted June 16, 2006 Report Share Posted June 16, 2006 actually, I viewed a application can do my issues ago, I remember that software is downloaded from some website, as I doubled click it to install, that application prompts a dialog box to ask people input CD key, and I found at that time, keyboard and mouse were disabled, and can see the CD key was inputted automatically by its software, after finished input CD key, the mouse and keyboard's function were restored ,I don't know how it did. Capturing events from other applications is something only doable with Windows API programming and with some involved ones too, using callbacks and such. Search MSDN for filter hooks such as the SetWindowsHookEx function does. Basically you have to install a global filter hook for the events you want to block, implement the callback function that receives the redirected events and discards them depending on the passed parameters etc. Doing this for LabVIEW will absolutely positively mean that you have to write an intermediate DLL. Rolf Kalbermatter Quote Link to comment
Cool-LV Posted June 17, 2006 Author Report Share Posted June 17, 2006 Capturing events from other applications is something only doable with Windows API programming and with some involved ones too, using callbacks and such. Search MSDN for filter hooks such as the SetWindowsHookEx function does. Basically you have to install a global filter hook for the events you want to block, implement the callback function that receives the redirected events and discards them depending on the passed parameters etc. Doing this for LabVIEW will absolutely positively mean that you have to write an intermediate DLL.Rolf Kalbermatter Thanks Rolf, yup, I have searched MSDN, but I haven't got any info about my goal :headbang: you wrote "have to install a global filter hook for the events you want to block" is this handle only ? haven't any simple way to reach it ? just call an or two APIs ? Quote Link to comment
Rolf Kalbermatter Posted June 26, 2006 Report Share Posted June 26, 2006 Thanks Rolf, yup, I have searched MSDN, but I haven't got any info about my goal :headbang: you wrote "have to install a global filter hook for the events you want to block" is this handle only ? haven't any simple way to reach it ? just call an or two APIs ? The SetWindowsHookEx function takes as one of the paramaters a callback function. This is a function pointer and can only really be confortable done in C so you will have to write a DLL in C that does the hooking. The callback function will inspect the message passed to it and either modify some parameters, deny handling of the message altogether or allow handling of the message unaltered. The return value of your callback function determines if the message should be further handled or not. It's a low level work area and if your callback function does the wrong thing you can get your Windows system in a rather hard to control state. (Ctrl-Alt-Del) may be your only friend then or the reset button. Rolf Kalbermatter Quote Link to comment
Cool-LV Posted July 1, 2006 Author Report Share Posted July 1, 2006 The SetWindowsHookEx function takes as one of the paramaters a callback function. This is a function pointer and can only really be confortable done in C so you will have to write a DLL in C that does the hooking. The callback function will inspect the message passed to it and either modify some parameters, deny handling of the message altogether or allow handling of the message unaltered. The return value of your callback function determines if the message should be further handled or not.It's a low level work area and if your callback function does the wrong thing you can get your Windows system in a rather hard to control state. (Ctrl-Alt-Del) may be your only friend then or the reset button. Rolf Kalbermatter Thanks Rolf Kalbermatter, but I am not familiar with C language of this controlling . So, anybody can help to make a DLL or a sample will be great appreciation. Quote Link to comment
Rolf Kalbermatter Posted July 4, 2006 Report Share Posted July 4, 2006 Thanks Rolf Kalbermatter, but I am not familiar with C language of this controlling . So, anybody can help to make a DLL or a sample will be great appreciation. Maybe that would be a chance to learn C? It's still THE engineering programming language and won't go away anywhere soon. Having some knowledge about C programming will always be an added bonus in almost any engineering profession where you even remotely need to get your hands on a computer. I'm not volunteering to write this thing for you, sorry. It's going to be a time consuming exercise in any case and to get it work exactly as you envision it will probably get a hard exercise for someone else than yourself. Rolf Kalbermatter Quote Link to comment
Cool-LV Posted July 4, 2006 Author Report Share Posted July 4, 2006 Maybe that would be a chance to learn C? It's still THE engineering programming language and won't go away anywhere soon. Having some knowledge about C programming will always be an added bonus in almost any engineering profession where you even remotely need to get your hands on a computer.I'm not volunteering to write this thing for you, sorry. It's going to be a time consuming exercise in any case and to get it work exactly as you envision it will probably get a hard exercise for someone else than yourself. Rolf Kalbermatter rolfk, OK, I know, anyway, thanks for your issues. yup, they are reasonable. Quote Link to comment
Anders Björk Posted November 21, 2006 Report Share Posted November 21, 2006 rolfk, OK, I know, anyway, thanks for your issues. yup, they are reasonable. On sysinternals page there is a filter for disabling caps-lock. There were some pointers to information.. http://www.microsoft.com/technet/sysintern...s/Ctrl2Cap.mspx Quote Link to comment
Cool-LV Posted November 24, 2006 Author Report Share Posted November 24, 2006 Thanks all, the goal that I got ! Quote Link to comment
crelf Posted November 24, 2006 Report Share Posted November 24, 2006 Thanks all, the goal that I got ! So how did you end up doing it? Please share your findings with us :thumbup: It's only through the sharing of our triumphs and failures that we learn for each other... Quote Link to comment
Cool-LV Posted November 26, 2006 Author Report Share Posted November 26, 2006 So how did you end up doing it? Please share your findings with us :thumbup: It's only through the sharing of our triumphs and failures that we learn for each other... Hi, I use "Block input" to disable keyboard and mouse function, and "Sendkey" to do the send key, I remember that I issued a topic here which is sendkey function no response, that is what my goal is. Quote Link to comment
crelf Posted November 27, 2006 Report Share Posted November 27, 2006 I use "Block input" to disable keyboard and mouse function, and "Sendkey" to do the send key, I remember that I issued a topic here which is sendkey function no response, that is what my goal is. That's a pretty cool workaround Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.