c++ - 如何实现 WTSRegisterSessionNotification 功能
问题描述
我想WTSRegisterSessionNotification
为我的项目实现功能,现在我被困住了HINSTANCE hInstance;
我想要一个编码示例如何在 C++ 中实现 HINSTANCE
#include <windows.h>
#include <stdio.h>
#include <iostream>
#include <string>
#include "Wtsapi32.h"
#include <tchar.h>
#pragma comment( lib, "user32.lib" )
using namespace std;
static TCHAR szWindowClass[] = _T("win32app");
// The string that appears in the application's title bar.
static TCHAR szTitle[] = _T("Win32 Guided Tour Application");
void main()
{
// Lock the workstation.
HWND hWnd = CreateWindow(
szWindowClass,
szTitle,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT,
500, 100,
NULL,
NULL,
GetModuleHandle(NULL),
NULL
);
cout<< WTSRegisterSessionNotification(hWnd, NOTIFY_FOR_ALL_SESSIONS);;
if (!LockWorkStation())
{
printf("LockWorkStation failed with %d\n", GetLastError());
}
cout << WTSRegisterSessionNotification(hWnd, NOTIFY_FOR_ALL_SESSIONS);;
system("pause");
}
我要实施WTSRegisterSessionNotification(hwnd, NOTIFY_FOR_ALL_SESSIONS);
我收到此错误:
LNK2019 未解析的外部符号 _WTSRegisterSessionNotification@8 在函数 _main 中引用
并找出它返回的值
解决方案
推荐阅读
- jquery - 无法从列表组项中获取 ajax 请求的值
- javascript - 加载带有噩梦的页面
- mysql - 无法连接到mysql数据库错误用户拒绝访问...(使用密码:是)
- javascript - 使用 Picker 时反应原生 _this.setState 未定义
- ionic4 - 无法启动新的 Ionic4 项目
- r - 如何在 R Shiny 中限制每天一次将文件导入到 shinyApp?
- c++ - 如何配置 CMake 以特定顺序构建多个项目?
- python - OSError:[Errno 24] 使用 pytorch 数据加载器时 Windows 10 中打开的文件过多
- html - 删除社交菜单页脚
- javascript - n 的值如何在递归中减小