473,383 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

simulate ctrl+alt+delete keys in windows

Hi all

i want to simulate the ctrl + alt + delete keys

I am facing problem with this code. I able to get the reference of the "winlogon" desktop but am unable to simulate the ctrl + alt + delete keys.

can any one help please.


HDESK desktop;
ofstream myfile;

HDESK old_desktop = GetThreadDesktop(GetCurrentThreadId());
myfile.open ("c:\\desktop.txt");
// Attempt to open the named desktop
esktop = OpenDesktop("Winlogon", 0, FALSE,
DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW |
DESKTOP_ENUMERATE | DESKTOP_HOOKCONTROL |
DESKTOP_WRITEOBJECTS | DESKTOP_READOBJECTS |
DESKTOP_SWITCHDESKTOP | GENERIC_WRITE);

if(desktop!=NULL){
myfile << "desktop found.\n";
}else{
myfile << "desktop not found.\n";
}
HWND hwndCtrlAltDel = FindWindow("SAS window class", "SAS window");
if (hwndCtrlAltDel == NULL) {
myfile << "SAS window not found.\n";
hwndCtrlAltDel = HWND_BROADCAST;
}
PostMessage(hwndCtrlAltDel, WM_HOTKEY, 0, MAKELONG(MOD_ALT | MOD_CONTROL, VK_DELETE));

HWND logonwindow = FindWindow("", "Log On to Windows");
if (logonwindow == NULL) {
myfile << "logon window not found.\n";
}
myfile.close();
Feb 16 '08 #1
3 4352
Why not just start taskmgr.exe? I think simulating keystroke events might also work.
Feb 18 '08 #2
no i wanted to simulate the keys remotely

for this i had embedded the above code in the a service.

I send an event to the service to simulate the ctrl+alt+delete keys.

I am not able to find the SAS window I am getting NULL for the first time. Also broadcasting message to all the windows dosen't seems to work at all. I have a problem with this section of code below.

HWND hwndCtrlAltDel = FindWindow("SAS window class", "SAS window");
if (hwndCtrlAltDel == NULL) {
myfile << "SAS window not found.\n";
hwndCtrlAltDel = HWND_BROADCAST;
}
PostMessage(hwndCtrlAltDel, WM_HOTKEY, 0, MAKELONG(MOD_ALT | MOD_CONTROL, VK_DELETE));
Feb 19 '08 #3
sicarie
4,677 Expert Mod 4TB
Sounds like you're trying to remotely log on to a Windows machine, is this right?
Feb 19 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Greg | last post by:
I am developing an application where I need to secure a workstation for periods of time. I can use BlockInput to stop users from task switching or messing with the keyboard, but I would like to...
2
by: SlasherStanley | last post by:
Hi Is there a way to capture CTRL - ALT - DELETE? I need to write a program that will stop people logging in during set periods. If this is not possible, Can I lock the Keyboard & Mouse?...
4
by: Brad | last post by:
Hello All, I am working on a kiosk application for a library. I do not want users to be able to hit Ctrl-Alt-Delete and exit the kiosk application. I did some searching on the web but did not...
3
by: armknp | last post by:
I am working on webpage. I want to make it launch other program shortcut which is Ctrl+Alt+something. Is it possible to write javascript to press the shortcut? So the user won't have to press many...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.