从我的应用程序发送消息Ctrl + Alt + Del [英] Sending the message Ctrl+Alt+Del from my application

查看:132
本文介绍了从我的应用程序发送消息Ctrl + Alt + Del的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在MFC中编写一个小的实用程序,该实用程序将 Ctrl + Alt + Del 消息发送到OS.谁能帮我实现这个目标?我试过了:

I want to write a small utility in MFC which sends the Ctrl+Alt+Del message to OS. Can any one help me how do I achieve this? I tried:

::PostMessage(HWND_BROADCAST, WM_HOTKEY, 0, MAKELONG( MOD_CONTROL | MOD_ALT, VK_DELETE));

但这不起作用.

我想发送 Ctrl + Alt + Del 而不调用TaskMgr.exe.另外,它适用于我的本地操作系统(Windows XP Service Pack 2).基本上,我想使用此应用程序来锁定我的计算机,并计划一些操作以及锁定.

I want to send Ctrl+Alt+Del not to invoke TaskMgr.exe. Also, it is for my local OS (Windows XP Service pack 2). Basically I want to use this application to lock my machine and schedule some actions along with locking.

推荐答案

这不是您可以模拟的按键.它被称为安全注意序列". 以下是调用它的方法:从远程桌面(XP +解决方案):

This is not a keystroke you can simulate. It's called the "Secure Attention Sequence". Here's how to invoke it FROM A REMOTE DESKTOP (XP+ solution):

include <shldisp.h>

IShellDispatch4 *pShell;

CoInitialize(NULL);

HRESULT hr = CoCreateInstance(CLSID_Shell, NULL, CLSCTX_INPROC_SERVER,
IID_IShellDispatch, (void**)&pShell);

if(SUCCEEDED(hr))
pShell->WindowsSecurity();

CoUninitialize();

从本地桌面调用它的唯一解决方案是使用SASLib.这不是公开的.将注释写到saslib@microsoft.com以请求它.

The only solution to invoke it from the local desktop is to use SASLib. It's not public. Write a note to saslib@microsoft.com to request it.

等等!您想锁定机器吗?只需调用 LockWorkStation()!单击链接以获取有关头文件,lib文件及所有其他详细信息的更多信息.

Wait! You want to lock the machine? Just call LockWorkStation()! Click the link for more info about header file, lib file et all other details.

这篇关于从我的应用程序发送消息Ctrl + Alt + Del的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆