Cool-LV Posted July 13, 2006 Report Share Posted July 13, 2006 Hi, I searched MSDN for doing "SendInput function" and I follow MSDN tells to call User32's Sendinput function, but my sample hasn't any response. why ? THe MSDN link is below SendInput Input Structure Download File:post-4703-1152765070.vi Quote Link to comment
bsvingen Posted July 13, 2006 Report Share Posted July 13, 2006 You are not calling the correct function. SendInput should return an UINT, while your call does not have a return value (you have set it to void). From MSDN: UINT SendInput( UINT nInputs, LPINPUT pInputs, int cbSize); Add UINT (whatever kind of int that is) as the return value, and it should work. Maybe you also should make the call reentrant. Quote Link to comment
cosmin Posted July 13, 2006 Report Share Posted July 13, 2006 Hi, I searched MSDN for doing "SendInput function" and I follow MSDN tells to call User32's Sendinput function, but my sample hasn't any response. why ? THe MSDN link is below SendInput Input Structure Hi, work from exp below, your vi is a little messyDownload File:post-4089-1152812598.vi cosmin Quote Link to comment
Cool-LV Posted July 14, 2006 Report Share Posted July 14, 2006 Hi,work from exp below, your vi is a little messyDownload File:post-4089-1152812598.vi cosmin Thanks All, thanks cosmin, and I have tried your enclosed vi, I open NotePad to do the test, I highlight the Execution to run the vi, as the vi executes run action, I quickly switch the active window is NotePad, but the result is fail, no any response, no character inputted at NotePad, no matter I input wscan or wVK's count, the virtual key code is from below Hex code, Key Code but we can see the feedback parameter would turn to 1, what is the focal behavior ? Quote Link to comment
cosmin Posted July 15, 2006 Report Share Posted July 15, 2006 Thanks All, thanks cosmin, and I have tried your enclosed vi, I open NotePad to do the test, I highlight the Execution to run the vi, as the vi executes run action, I quickly switch the active window is NotePad, but the result is fail, no any response, no character inputted at NotePad, no matter I input wscan or wVK's count, the virtual key code is from below Hex code, Key Code but we can see the feedback parameter would turn to 1, what is the focal behavior ? Hi, run the attached vi in highlight execution cosmin Download File:post-4089-1152982483.vi Quote Link to comment
Rolf Kalbermatter Posted July 15, 2006 Report Share Posted July 15, 2006 Thanks All, thanks cosmin, and I have tried your enclosed vi, I open NotePad to do the test, I highlight the Execution to run the vi, as the vi executes run action, I quickly switch the active window is NotePad, but the result is fail, no any response, no character inputted at NotePad, no matter I input wscan or wVK's count, the virtual key code is from below Hex code, Key Code but we can see the feedback parameter would turn to 1, what is the focal behavior ? So you want to send a keystroke to another application by placing it in the keyboard queue and honestly believe that you have any change to switch to the other application after having started the VI? Because keystrokes are only sent to the active application! I would recommend to try this on a mechanical computer but with any modern computer your VI has already long terminated before you can even think about switching to another application, lets forget about moving your hand to the mouse and activate that other application. Rolf Kalbermatter Quote Link to comment
Cool-LV Posted July 17, 2006 Report Share Posted July 17, 2006 Hi,run the attached vi in highlight execution cosmin Thanks Cosmin, that is great, it works. Now I want to tell, why I use this Sendinput, not keyboard_event send key store, that is why I was asking to disable/retore title at this forums, as I use "block input" function, sendinput can help to input keys also, that is my goal that I am looking for along, but keyboard_event send key store can't do. Quote Link to comment
cosmin Posted July 17, 2006 Report Share Posted July 17, 2006 Thanks Cosmin, that is great, it works. Now I want to tell, why I use this Sendinput, not keyboard_event send key store, that is why I was asking to disable/retore title at this forums, as I use "block input" function, sendinput can help to input keys also, that is my goal that I am looking for along, but keyboard_event send key store can't do. just remember to send 2 flags for every key pressed (0 and KEYUP) and index the array to pass the pointer to every element from the array not the pointer to arrat itself cosmin Quote Link to comment
Cool-LV Posted July 18, 2006 Report Share Posted July 18, 2006 just remember to send 2 flags for every key pressed (0 and KEYUP) and index the array to pass the pointer to every element from the array not the pointer to arrat itselfcosmin Thanks Cosmin, you are a kind man, Yup ,I knew, I used keyboard_event and mouse_event to do the sendkey exercise ago, and make SubVI, now I am using sendinput function( I have made send keystroke and mouse click SubVi with your thread ) to achieving my project. thanks your great helping ! I am full of appreciations. Quote Link to comment
kilv Posted October 27, 2006 Author Report Share Posted October 27, 2006 just remember to send 2 flags for every key pressed (0 and KEYUP) and index the array to pass the pointer to every element from the array not the pointer to arrat itselfcosmin Hello, I am New to Labview ,I learned more from Your Topic . Did you can Post your Mouse subVi to Share With Us? Thanks very much!!! Quote Link to comment
victorpiper Posted March 17, 2007 Report Share Posted March 17, 2007 QUOTE(cosmin @ Jul 15 2006, 11:55 AM) Hi,run the attached vi in highlight execution cosmin Hello cosmin, I am trying to figure out why cbSize = 28. Could you please show me how to calculate the size of the input structure? Thanks, Victor Quote Link to comment
cosmin Posted April 5, 2007 Report Share Posted April 5, 2007 QUOTE(victorpiper @ Mar 16 2007, 07:21 PM) Hello cosmin, I am trying to figure out why cbSize = 28. Could you please show me how to calculate the size of the input structure?Thanks, Victor hi, just count the number of bytes from the Input structure http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/userinput/keyboardinput/keyboardinputreference/keyboardinputstructures/input.asp' target="_blank">http://msdn.microsoft.com/library/default....tures/input.asp cosmin Quote Link to comment
DRivel Posted October 17, 2008 Report Share Posted October 17, 2008 QUOTE (victorpiper @ Mar 16 2007, 05:21 PM) Hello cosmin, I am trying to figure out why cbSize = 28. Could you please show me how to calculate the size of the input structure?Thanks, Victor Hi, (I know this is an old thread) Having spent many hours trying to make SendInput work, I'm happy to find the solution here - to set cbSize to 28, instead of 20, the actual size of the KEYBDINPUT INPUT structure. Like Victor, I also wondered why 28 instead of 20, and expect it's because the INPUT structure is a union of three structures, and the size of INPUT is being determined by the largest structure in the union, which is the MOUSEINPUT structure. Belated THANKS! to COSMIN and Victor 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.