我无法创建新的 Window Station 来运行我的应用程序
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
wprintf(L"SetProcessWindowStation() before: %x\n", GetProcessWindowStation());
HWINSTA winSta = CreateWindowStation(_T("hiddenWinSta"), 0, 0, NULL);
if (winSta == NULL)
{
wprintf(L"CreateWindowStation() failed, error %d!\n", GetLastError());
}else
wprintf(L"CreateWindowStation() is OK!\n");
SetProcessWindowStation(winSta);
OpenDesktop(L"default", 0, FALSE, READ_CONTROL | WRITE_DAC | DESKTOP_WRITEOBJECTS | DESKTOP_READOBJECTS);
wprintf(L"SetProcessWindowStation() after: %x\n", GetProcessWindowStation());
system("pause");
return 0;
}
我可以对新的 Windows 站进行截图而不是 winsta0 和桌面默认设置吗?请帮我 :(
输出
SetProcessWindowStation() before: 30
CreateWindowStation() failed, error 5!
SetProcessWindowStation() after: 30
Press any key to continue . . .