从我的应用程序发送消息 Ctrl+Alt+Del

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

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

问题描述

我想在 MFC 中编写一个小实用程序,它将 Ctrl+Alt+Del 消息发送到操作系统.任何人都可以帮助我如何实现这一目标?我试过了:

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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:从我的应用程序发送消息 Ctrl+Alt+Del

基础教程推荐