Sending the message Ctrl+Alt+Del from my application(从我的应用程序发送消息 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
基础教程推荐
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- CString 到 char* 2021-01-01
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
- 初始化列表*参数*评估顺序 2021-01-01
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
