我想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 中引用
并找出它返回的值