News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

sendinput

Started by ecube, December 18, 2008, 10:18:26 AM

Previous topic - Next topic

ecube


INPUT input[2];
memset(input, 0, sizeof(input));
input[0].type = INPUT_KEYBOARD;

input[0].ki.wVk = 65; // ASCI value of A
input[0].ki.dwFlags = 0;
input[0].ki.time = 0;
input[0].ki.dwExtraInfo = 0;

input[1].ki.wVk = 65; // ASCI value of A
input[1].ki.dwFlags = KEYEVENTF_KEYUP;
input[1].ki.time = 0;
input[1].ki.dwExtraInfo = 0;

SendInput(2,input,sizeof(INPUT));




can someone help me translate this to masm please. i'm not sure how to do the array stuff

also the INPUT struct looks like this


typedef struct tagINPUT {
  DWORD type;
  union {MOUSEINPUT mi;
            KEYBDINPUT ki;
            HARDWAREINPUT hi;
           };
  }INPUT, *PINPUT;


my best guess is

INPUT struct
type DWORD ?
mi MOUSEINPUT <>
hi HARDWAREINPUT <>
INPUT ends

don't know how to do union.

jdoe


:U




MOUSEINPUT STRUCT
_dx DWORD ?
_dy DWORD ?
mouseData DWORD ?
dwFlags DWORD ?
time DWORD ?
dwExtraInfo DWORD ?
MOUSEINPUT ENDS

KEYBDINPUT STRUCT
wVk WORD ?
wScan WORD ?
dwFlags DWORD ?
time DWORD ?
dwExtraInfo DWORD ?
KEYBDINPUT ENDS

HARDWAREINPUT STRUCT
uMsg DWORD ?
wParamL WORD ?
wParamH WORD ?
HARDWAREINPUT ENDS

INPUT STRUCT
_type DWORD ?
union
  mi MOUSEINPUT <>
  ki KEYBDINPUT <>
  hi HARDWAREINPUT <>
ends
INPUT ENDS




ecube

thanks buddy!


inputx INPUT <>

invoke RtlZeroMemory,addr inputx,sizeof INPUT
mov inputx._type,INPUT_KEYBOARD
mov inputx.ki.wVk,VK_RETURN

mov inputx.ki.dwFlags,0

mov inputx.ki.time,0
mov inputx.ki.wScan,0
mov inputx.ki.dwExtraInfo,0

invoke SendInput,1,addr inputx,sizeof INPUT

mov inputx.ki.dwExtraInfo,KEYEVENTF_KEYUP

invoke SendInput,1,addr inputx,sizeof INPUT


seems to work