What's new

Keys send

Doomulation

?????????????????????????
Ok just wondering what how you send keys like the vb command "sendkeys" in c++ without utilizing the .net classes? IMO, you have to disable a lot of good things to use those stupid managed classes.

Perhaps the sendmessage api?
Also...I had some problems using the Get/SetWindowText apis...I couldn't get them to get/set the text of a window with the handle. Instead, I used the mfc classes to obtain a CWnd class for the windows and utilize those to manipulate the text. When using the apis, the pointer returned is NULL and no error is reported.
What gives?
 

bjz

New member
What exactly are you doing? You could use GetAsyncKeystate(), or WM_KEYDOWN.

case WM_KEYDOWN:
{
if(wParam == VK_A)
{
DoShit();
}
}
break;
 

BlueYoshi

New member
Are you making .net app? In .net most of Win32 API is disabled in order to "protect" system. Using SendMessage() function with WM_KEYDOWN/WM_KEYUP messages you can esily simulate SendKeys, though this probably isn't possible in .net.
 

ingonab

New member
Doomulation said:
Ok just wondering what how you send keys like the vb command "sendkeys" in c++ without utilizing the .net classes?

Do you want to generate events to simulate the user pressing keys on the keyboard? (I don't know what sendkeys in VB does.)

You might be after:

keybd_event(...)

The keybd_event function synthesizes a keystroke. The system can use such a synthesized keystroke to generate a WM_KEYUP or WM_KEYDOWN message. The keyboard driver's interrupt handler calls the keybd_event function.

Windows NT: This function has been superseded. Use SendInput instead



SendInput(...)

The SendInput function synthesizes keystrokes, mouse motions, and button clicks.



If you're trying to synthesies keystrokes for the purpose of fooling programs that use DirectInput, the above methods won't work. :) --Because they don't use Windows Messages to get key presses. If this is the case, the alternative is quite a bit more complex.
 
OP
Doomulation

Doomulation

?????????????????????????
What I simply wish to do is not tell programs that keys are pressed; rather like set text on a textbox or something. Like sending a WM_SETTEXT message to a titlebar.
And yeah, .Net is the best. But I don't want to use the .net framework (lots of nasty runtime files and lots of good compiler options must be disabled :()
 

Eagle

aka Alshain
Moderator
I'm too lazy to look it up right now but isnt there a ONKEYBOARD(X as Char)? I dont know the exact name but I'm pretty sure there is a funtion to directly access keyboard keys when they are pressed.
 

tooie

New member
bjz said:
Come on, Anyone who gets off on windows API programming is obviously a sick individual lol

now lets see if any one uses int 2e to do windows programming...
 

Top