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


基础教程推荐
- C++结构和函数声明。为什么它不能编译? 2022-11-07
- 如何通过C程序打开命令提示符Cmd 2022-12-09
- 如何在 C++ 中初始化静态常量成员? 2022-01-01
- 在 C++ 中计算滚动/移动平均值 2021-01-01
- 这个宏可以转换成函数吗? 2022-01-01
- 如何将 std::pair 的排序 std::list 转换为 std::map 2022-01-01
- 静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么? 2021-01-01
- 如何检查GTK+3.0中的小部件类型? 2022-11-30
- 常量变量在标题中不起作用 2021-01-01
- 我有静态或动态 boost 库吗? 2021-01-01