470,843 Members | 1,372 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,843 developers. It's quick & easy.

SendInput() Always Returns "0"

Hello All,

I am writing a program that checks for the NumLock status and turns the NumLock on if it is off.
I'm not sure what I'm overlooking at this point, but the code will compile and run, but the SendInput call always returns "0".
Here is some of the code:

Beginning of Code...

static extern uint SendInput(uint nInputs, ref INPUT [] pInputs, int cbSize);

public struct INPUT
[FieldOffset(0)] public int type;
[FieldOffset(4)] public KEYBDINPUT ki;
public struct KEYBDINPUT
public short wVk;
public short wScan;
public int dwFlags;
public int time;
public IntPtr dwExtraInfo;

....Code Deleted...

INPUT [] input = new INPUT [1];
input[0].ki.wVk = 0x90;
input[0].type = 0x01;
uint result;
result = SendInput(1, ref input, input.Length);

....End of Code

result will always equal "0". Does anyone know what would cause this, or even better, how to get this to work? I'm at a complete loss.

Thank you in advance for your help,
Nov 16 '05 #1
1 1783
checkout the sample on this link

Mohamed Mahfouz
MEA Developer Support Center
ITworx on behalf of Microsoft EMEA GTSC

Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by build | last post: by
5 posts views Thread by Tim | last post: by
5 posts views Thread by Dan C Douglas | last post: by
9 posts views Thread by Klaus Johannes Rusch | last post: by
2 posts views Thread by Phillip Vong | last post: by
5 posts views Thread by yogeshmk | last post: by
2 posts views Thread by =?iso-8859-1?B?S2VyZW0gR/xtcvxrY/w=?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.