Forum
|
|
Launching Task Manager from a User Application, shall I launch tskmgr.exe / taskman.exe or use keybd_event API to simulate a Ctrl-Alt-Del key press?
|
SeaFarer |
|
Extremely Active Member
Group: Members
Posts: 1751
Member No.: 1464
Joined: 2-September 05
|
Hi, Is there a function or an undocumented method of opening Task Manager from a user application? For example: You would have a button or menu item that could be selected by mouse click versus having to actually press the Ctr-Alt-Del key combination manually. Incidentially a search of the board turned up nothing on this topic.
|
|
|
|
samael |
|
Typo-lord
Group: Moderators
Posts: 404
Member No.: 5187
Joined: 10-June 07
|
You can try the keybd_event API, but this does not get the job done under NT-based systems for the particular combination [ALT+CTRL+DEL]. Apart from the fact that this combination invokes different stuff (according to your PC configuration) on NT-based systems, even if it was invoking TaskManager on the first place, the code posted below won't work.... Dont know if this works under windows 98 though... The technique works for other key combinations, such as [ALT+TAB] for instance... CODE | ;///////////////////////////////////////////////////////////////////////////// ;// Simulate [ALT+CTRL+DEL] combination ; Won't work on NT based systems ???? ;/////////////////////////////////////////////////////////////////////////// invoke keybd_event, VK_CONTROL, 0E01Dh, KEYEVENTF_EXTENDEDKEY, NULL; Simulate CONTROL key Press invoke keybd_event, VK_MENU , 0E038h, KEYEVENTF_EXTENDEDKEY, NULL; Simulate ALT key Press invoke keybd_event, VK_DELETE, 0E053h, KEYEVENTF_EXTENDEDKEY, NULL; Simulate DELETE key Press
invoke keybd_event, VK_CONTROL, 0E01Dh, �KEYEVENTF_EXTENDEDKEY OR KEYEVENTF_KEYUP , 0; Simulate CONTROL key release invoke keybd_event, VK_MENU , 0E038h, �KEYEVENTF_EXTENDEDKEY OR KEYEVENTF_KEYUP , 0; Simulate ALT key release invoke keybd_event, VK_DELETE, 0E053h,KEYEVENTF_EXTENDEDKEY OR KEYEVENTF_KEYUP , 0; Simulate DELETE key release
;///////////////////////////////////////////////////////////////////////////// ;// Simulate [ALT+TAB] combination ; Works OK ??? ;///////////////////////////////////////////////////////////////////////////
invoke keybd_event, VK_MENU , 0E038h, KEYEVENTF_EXTENDEDKEY, NULL; Simulate ALT key Press invoke keybd_event, VK_TAB, 0Fh, NULL, NULL; Simulate TAB key Press Invoke Sleep,5000; Show the dialog for 5 seconds invoke keybd_event, VK_MENU , 0E038h, �KEYEVENTF_EXTENDEDKEY OR KEYEVENTF_KEYUP , 0; Simulate ALT key release invoke keybd_event, VK_TAB, 0Fh, �KEYEVENTF_KEYUP , 0; Simulate TAB key release |
|
|
|
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
Track this topic
Receive email notification when a reply has been made to this topic and you are not active on the board.
Subscribe to this forum
Receive email notification when a new topic is posted in this forum and you are not active on the board.
Download / Print this Topic
Download this topic in different formats or view a printer friendly version.
|
|
|