Click here to Skip to main content
15,921,062 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: error using #pragma pack(...) Pin
Jose Lamas Rios30-Aug-05 18:22
Jose Lamas Rios30-Aug-05 18:22 
QuestionRegistering controls using code Pin
Tom Wright30-Aug-05 6:39
Tom Wright30-Aug-05 6:39 
QuestionSendInput Problem Pin
Mohammad A Gdeisat30-Aug-05 6:18
Mohammad A Gdeisat30-Aug-05 6:18 
AnswerRe: SendInput Problem Pin
Rage30-Aug-05 7:05
professionalRage30-Aug-05 7:05 
GeneralRe: SendInput Problem Pin
Mohammad A Gdeisat30-Aug-05 7:51
Mohammad A Gdeisat30-Aug-05 7:51 
AnswerRe: SendInput Problem Pin
Jose Lamas Rios30-Aug-05 8:54
Jose Lamas Rios30-Aug-05 8:54 
GeneralRe: SendInput Problem Pin
Mohammad A Gdeisat30-Aug-05 10:22
Mohammad A Gdeisat30-Aug-05 10:22 
GeneralRe: SendInput Problem Pin
Jose Lamas Rios30-Aug-05 18:13
Jose Lamas Rios30-Aug-05 18:13 
I've been investigating this a bit.

Conclusion (short version):

You can't simulate Ctrl+Alt+Del.

Conclusion (longer version):

You can't simulate it as a keyboard sequence.

The proper way to simulate a Ctrl+Alt+Del is posting a broadcast WM_HOTKEY message. However, for that to work, the calling thread must be part of the Winlogon desktop.

You could use SwitchDesktop, but that in turn requires your thread to not have any open window or hook set.

There's a trick to work-around this too, which is published in many places, and is based on the open source of VNC. Basically, it requires spawning a new thread, and since this thread won't have any window or hook, it would in theory be able to switch to the Winlogon desktop and post the WM_HOTKEY. Some window in this desktop would react to the WM_HOTKEY message and respond in the usual way.

However, before calling SwitchDesktop you need to use OpenDesktop to obtain the handle of the Winlogon desktop. Although I'm not sure if this used to work in previous versions, it definitely doesn't work in modern versions. I've tried with WinXP+SP2, and every call to OpenDesktop for "Winlogon", no matter which access rights you request, fails with "access denied". From what I've seen in many forums, it doesn't work for Windows 2000 either.

I've seen claims that this would still work if your process is running as "LocalSystem", but I'm not sure about that.


--
jlr
http://jlamas.blogspot.com/[^]


-- modified at 0:13 Wednesday 31st August, 2005
QuestionProblem with Chris Mounder grid and KB893803v2 windows uppgrade. Pin
morefalt30-Aug-05 5:29
morefalt30-Aug-05 5:29 
QuestionI created an add-in for Visual C++ 6, please give me some comments and suggestions ^_^ Pin
ahzhuo30-Aug-05 5:04
ahzhuo30-Aug-05 5:04 
AnswerRe: I created an add-in for Visual C++ 6, please give me some comments and suggestions ^_^ Pin
toxcct30-Aug-05 5:06
toxcct30-Aug-05 5:06 
GeneralRe: I created an add-in for Visual C++ 6, please give me some comments and suggestions ^_^ Pin
ahzhuo30-Aug-05 5:13
ahzhuo30-Aug-05 5:13 
GeneralRe: I created an add-in for Visual C++ 6, please give me some comments and suggestions ^_^ Pin
toxcct30-Aug-05 5:14
toxcct30-Aug-05 5:14 
GeneralRe: I created an add-in for Visual C++ 6, please give me some comments and suggestions ^_^ Pin
toxcct30-Aug-05 5:16
toxcct30-Aug-05 5:16 
GeneralRe: I created an add-in for Visual C++ 6, please give me some comments and suggestions ^_^ Pin
Eytukan30-Aug-05 5:26
Eytukan30-Aug-05 5:26 
GeneralRe: I created an add-in for Visual C++ 6, please give me some comments and suggestions ^_^ Pin
ahzhuo30-Aug-05 5:30
ahzhuo30-Aug-05 5:30 
GeneralRe: I created an add-in for Visual C++ 6, please give me some comments and suggestions ^_^ Pin
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX30-Aug-05 6:08
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX30-Aug-05 6:08 
AnswerRe: I created an add-in for Visual C++ 6, please give me some comments and suggestions ^_^ Pin
John M. Drescher30-Aug-05 17:44
John M. Drescher30-Aug-05 17:44 
QuestionSearch Database Pin
Typheous30-Aug-05 4:34
Typheous30-Aug-05 4:34 
AnswerRe: Search Database Pin
dy1330-Aug-05 8:40
dy1330-Aug-05 8:40 
QuestionHowto Change language manually? Pin
dy1330-Aug-05 4:16
dy1330-Aug-05 4:16 
AnswerRe: Howto Change language manually? Pin
toxcct30-Aug-05 4:32
toxcct30-Aug-05 4:32 
GeneralRe: Howto Change language manually? Pin
dy1330-Aug-05 8:18
dy1330-Aug-05 8:18 
QuestionPlain icons in a CImageList Pin
lisux30-Aug-05 3:04
lisux30-Aug-05 3:04 
AnswerRe: Plain icons in a CImageList Pin
Rage30-Aug-05 6:54
professionalRage30-Aug-05 6:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.