Jump to content

SendInput no response


Recommended Posts

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.

Link to comment
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 ?

Link to comment
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

Link to comment
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

Link to comment
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.

Link to comment
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

Link to comment
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

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.

Link to comment
  • 3 months later...
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

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!!! :)

Link to comment
  • 4 months later...
  • 3 weeks later...
  • 1 year later...

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

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.