|
OK, I understood - it is in windows.h
|
|
|
|
|
Hello, I´m trying to do an application in c++ which It send the secuence Ctrl+Alt+Del. The code is:
keybd_event(VK_LCONTROL,0,0 , 0);
keybd_event(VK_MENU,0,0 , 0);
keybd_event(VK_DELETE,0,0 , 0);
::Sleep(50);
keybd_event(VK_DELETE,0, KEYEVENTF_KEYUP,0);
keybd_event(VK_MENU,0,KEYEVENTF_KEYUP,0);
keybd_event(VK_LCONTROL,0,KEYEVENTF_KEYUP,0);
but it doesn´t work.
Can help me? Thanks.
|
|
|
|
|
keybd_event is not working with ctrl+alt+delete keys simulation. I too agree. Let me have some time to work on it to get a solution. But you can lock your system using WinKey+'L',
keybd_event(VK_LWIN,0, 0 , 0);
keybd_event(VkKeyScan('L'),0xa6,0 , 0);
keybd_event(VkKeyScan('L'),0xa6,KEYEVENTF_KEYUP , 0);
keybd_event(VK_LWIN,0,KEYEVENTF_KEYUP,0);
or if you want to bring task manager, use "Ctrl+Shift+Esc"
Hope it may help you...
Thanks,
Naren Neelamegam
|
|
|
|
|
How can I send Ctrl+Alt+H. Nothing happens when I run this code :
keybd_event((byte)Convert.ToInt32(Keys.Control), (byte)MapVirtualKey(Convert.ToInt32(Keys.Control), 0), 0, 0);
keybd_event((byte)Convert.ToInt32(Keys.Alt), (byte)MapVirtualKey(Convert.ToInt32(Keys.Alt), 0), 0, 0);
keybd_event((byte)Keys.H, (byte)MapVirtualKey(Convert.ToInt32(Keys.H), 0), 0, 0);
keybd_event((byte)Keys.H, (byte)MapVirtualKey(Convert.ToInt32(Keys.H), 0), KEYEVENTF_KEYUP, 0);
keybd_event((byte)Convert.ToInt32(Keys.Alt), (byte)MapVirtualKey(Convert.ToInt32(Keys.Alt), 0), KEYEVENTF_KEYUP, 0);
keybd_event((byte)Convert.ToInt32(Keys.Control), (byte)MapVirtualKey(Convert.ToInt32(Keys.Control), 0), KEYEVENTF_KEYUP, 0);
|
|
|
|
|
[quote]
But you can lock your system using WinKey+'L',
keybd_event(VK_LWIN,0, 0 , 0);
keybd_event(VkKeyScan('L'),0xa6,0 , 0);
keybd_event(VkKeyScan('L'),0xa6,KEYEVENTF_KEYUP , 0);
keybd_event(VK_LWIN,0,KEYEVENTF_KEYUP,0);
[/quote]
At least for WinXp...Win7 - unworkable
|
|
|
|
|
I think only the system account and some of the services accounts can generate a CTRL+ALT+DEL event.
|
|
|
|
|
But , how can I send Ctrl+Alt+H . Nothing happens when I run this code:
keybd_event((byte)Convert.ToInt32(Keys.Control), (byte)MapVirtualKey(Convert.ToInt32(Keys.Control), 0), 0, 0);
keybd_event((byte)Convert.ToInt32(Keys.Alt), (byte)MapVirtualKey(Convert.ToInt32(Keys.Alt), 0), 0, 0);
keybd_event((byte)Keys.H, (byte)MapVirtualKey(Convert.ToInt32(Keys.H), 0), 0, 0);
keybd_event((byte)Keys.H, (byte)MapVirtualKey(Convert.ToInt32(Keys.H), 0), KEYEVENTF_KEYUP, 0);
keybd_event((byte)Convert.ToInt32(Keys.Alt), (byte)MapVirtualKey(Convert.ToInt32(Keys.Alt), 0), KEYEVENTF_KEYUP, 0);
keybd_event((byte)Convert.ToInt32(Keys.Control), (byte)MapVirtualKey(Convert.ToInt32(Keys.Control), 0), KEYEVENTF_KEYUP, 0);
|
|
|
|
|
Hi,
sir can u tell me how to send a unicode character using keybd_event() function in an application.(of cource vc++6)
Wating for replay.
mahfuz
|
|
|
|
|
Have you any idea on how to capture the keyboard events in my application and/or other applications?
|
|
|
|
|
this Will api will HElp You out
GetAsyncKeyState
-----------------------------
"I Think this Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
You can use SetWindowsHookEx too.
I LOVE ALOK.
|
|
|
|
|
What with PageUp and PageDown .... Are there virtual keycodes for this keys ?? .... btw - great "code project"
|
|
|
|
|
Reply is so late.
//PGDN
keybd_event(VK_NEXT, 0x22, 0, 0);
keybd_event(VK_NEXT,0x22, KEYEVENTF_KEYUP,0);
//PGUP
keybd_event(VK_PRIOR , 0x21, 0, 0);
keybd_event(VK_PRIOR ,0x21, KEYEVENTF_KEYUP,0);
Hope this help you.
|
|
|
|
|
Hi i have tried implementing the pageup and down method using visual c++ ..
however i have gotten a fatal error of LNK 1561: entry point must be defined. here is my code below. i would greatly appreciate it if anyone would lend a helping hand.
private: System::Void PageUp_Click(System::Object^ sender, System::EventArgs^ e)
{
// Simulate a key press
keybd_event( VK_PRIOR,
0x45,
KEYEVENTF_EXTENDEDKEY | 0,
0 );
// Simulate a key release
keybd_event( VK_PRIOR,
0x45,
KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP,
0);
}
|
|
|
|
|
Good Very Clearly!
PLS write an article about mouse_events() too!
All for one one for all
|
|
|
|
|
You article is simplyl superb and down-right simple. Keep up the good work! Got my "5".
The beginning of knowledge is the fear of God
|
|
|
|
|
Thank you Friend
Nareen Neelamegam
|
|
|
|
|
Short and sweet; right to the point!! A lot of articles should take cue from this one.
The only thing missing is a program sample.
Got my '5' anyway.
William
Fortes in fide et opere!
|
|
|
|
|
I thought the "Example Code" is enough. Just you can copy paste the code anywhere in your program and you will get the result.
And thank you for your rating.
Nareen Neelamegam
|
|
|
|
|
The keybd_event() function has been superseded by SendInput() on Windows 98, Windows NT 4.0 Service Pack 3 and later... this is documented in MSDN.
Regards,
Miguel Hasse
|
|
|
|
|
|
Thank you Friend
Nareen Neelamegam
|
|
|
|
|