DllImport.INPUT[] input1 = new DllImport.INPUT[1];
input1[0].type = 1;
input1[0].keyboardInput.time = 0;
input1[0].keyboardInput.wScan = 0;
input1[0].keyboardInput.dwExtraInfo = DllImport.GetMessageExtraInfo();
input1[0].keyboardInput.dwFlags = 0;
input1[0].keyboardInput.dwFlags = DllImport.WM_KEYDOWN;
input1[0].keyboardInput.wVk = (short)DllImport.VK_SHIFT;
DllImport.SendInput(1, input1, Marshal.SizeOf(input1[0]));
比如CTRL键,发送过后,win7电脑的CTRL就一直处于按下状态,XP下没问题。有人遇到过吗?试了很多方法都不行。