I'm looking for something to programmically press a keystroke, I've been looking on google and I'm assuming im just not searching for the right thing. Can anyone help me?
Using API to press a key
BlitzMax Forums/BlitzMax Programming/Using API to press a key What are you trying to fool? BlitzMax or the OS?
I think the correct term ( or *one* correct term, anyway ) is synthetic keyboard events, but I'm not sure if it's even possible at the OS level.
I think the correct term ( or *one* correct term, anyway ) is synthetic keyboard events, but I'm not sure if it's even possible at the OS level.
I'm not trying to fool anything, I'm trying to create a macro system, you can record keyboard and mouse events, then play them back, I just want to beable to do something like this, only for the keyboard.
I have a code example in the archives that clicks the mouse using Windows' SendInput function. You could modify this to insert keyboard events. Do a search for MSDN + Sendinput on google.
Alternatively try a search for "AutoIT" on these forums. It may be of use I'm told.
While searching for what nomen luni told me to, i found this, now i just need to get all the variables for the keys, I dunno where you guys come up with all these api variables, but id like to get them for this.
Found the variables, source
Const VK_0 = $30 Const VK_1 = $31 Const VK_2 = $32 Const VK_3 = $33 Const VK_4 = $34 Const VK_5 = $35 Const VK_6 = $36 Const VK_7 = $37 Const VK_8 = $38 Const VK_9 = $39 Const VK_A = $41 Const VK_B = $42 Const VK_C = $43 Const VK_D = $44 Const VK_E = $45 Const VK_F = $46 Const VK_G = $47 Const VK_H = $48 Const VK_I = $49 Const VK_J = $4A Const VK_K = $4B Const VK_L = $4C Const VK_M = $4D Const VK_N = $4E Const VK_O = $4F Const VK_P = $50 Const VK_Q = $51 Const VK_R = $52 Const VK_S = $53 Const VK_T = $54 Const VK_U = $55 Const VK_V = $56 Const VK_W = $57 Const VK_X = $58 Const VK_Y = $59 Const VK_Z = $5A Const VK_ADD = $6B Const VK_ATTN = $F6 Const VK_BACK = $8 Const VK_CANCEL = $3 Const VK_CAPITAL = $14 Const VK_CLEAR = $C Const VK_CONTROL = $11 Const VK_CRSEL = $F7 Const VK_DECIMAL = $6E Const VK_DELETE = $2E Const VK_DIVIDE = $6F Const VK_DOWN = $28 Const VK_END = $23 Const VK_EREOF = $F9 Const VK_ESCAPE = $1B Const VK_EXECUTE = $2B Const VK_EXSEL = $F8 Const VK_F1 = $70 Const VK_F10 = $79 Const VK_F11 = $7A Const VK_F12 = $7B Const VK_F13 = $7C Const VK_F14 = $7D Const VK_F15 = $7E Const VK_F16 = $7F Const VK_F17 = $80 Const VK_F18 = $81 Const VK_F19 = $82 Const VK_F2 = $71 Const VK_F20 = $83 Const VK_F21 = $84 Const VK_F22 = $85 Const VK_F23 = $86 Const VK_F24 = $87 Const VK_F3 = $72 Const VK_F4 = $73 Const VK_F5 = $74 Const VK_F6 = $75 Const VK_F7 = $76 Const VK_F8 = $77 Const VK_F9 = $78 Const VK_HELP = $2F Const VK_HOME = $24 Const VK_INSERT = $2D Const VK_LBUTTON = $1 Const VK_LCONTROL = $A2 Const VK_LEFT = $25 Const VK_LMENU = $A4 Const VK_LSHIFT = $A0 Const VK_MBUTTON = $4 Const VK_MENU = $12 Const VK_MULTIPLY = $6A Const VK_NEXT = $22 Const VK_NONAME = $FC Const VK_NUMLOCK = $90 Const VK_NUMPAD0 = $60 Const VK_NUMPAD1 = $61 Const VK_NUMPAD2 = $62 Const VK_NUMPAD3 = $63 Const VK_NUMPAD4 = $64 Const VK_NUMPAD5 = $65 Const VK_NUMPAD6 = $66 Const VK_NUMPAD7 = $67 Const VK_NUMPAD8 = $68 Const VK_NUMPAD9 = $69 Const VK_OEM_CLEAR = $FE Const VK_PA1 = $FD Const VK_PAUSE = $13 Const VK_PLAY = $FA Const VK_PRINT = $2A Const VK_PRIOR = $21 Const VK_PROCESSKEY = $E5 Const VK_RBUTTON = $2 Const VK_RCONTROL = $A3 Const VK_RETURN = $D Const VK_RIGHT = $27 Const VK_RMENU = $A5 Const VK_RSHIFT = $A1 Const VK_SCROLL = $91 Const VK_SELECT = $29 Const VK_SEPARATOR = $6C Const VK_SHIFT = $10 Const VK_SNAPSHOT = $2C Const VK_SPACE = $20 Const VK_SUBTRACT = $6D Const VK_TAB = $9 Const VK_UP = $26 Const VK_ZOOM = $FB
I'm getting this error "Compile Error: Missing type specifier", on the dwFlags variable in the extern for keybd_event, I searched MSDN to find the type for this and it is a "DWORD", however I noticed that, "DWORD" is not a valid variable type in BMax, help me out here?
DWord is a double word=2*16 bits, which is a an unsigned long in Blitz I think (or a long will do).
Would you consider sticking your function in the code archives when it's done? Could be useful for me! : )
Would you consider sticking your function in the code archives when it's done? Could be useful for me! : )
OK thanks Plash!
No problem.