• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GetThreadDesktop函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GetThreadDesktop函数的典型用法代码示例。如果您正苦于以下问题:C++ GetThreadDesktop函数的具体用法?C++ GetThreadDesktop怎么用?C++ GetThreadDesktop使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GetThreadDesktop函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: SimulateCtrlAltDelThreadFn

void *
SimulateCtrlAltDelThreadFn(void *context)
{
	HDESK old_desktop = GetThreadDesktop(GetCurrentThreadId());
	HDESK winlogon_desk = 0;
	// Switch into the Winlogon desktop
	if (!vncService::SelectDesktop("Winlogon", &winlogon_desk))
	{
		vnclog.Print(LL_INTERR, VNCLOG("failed to select logon desktop\n"));
		vncTimedMsgBox::Do(
									sz_ID_CADERROR,
									sz_ID_ULTRAVNC_WARNING,
									MB_ICONINFORMATION | MB_OK
									);
		return FALSE;
	}

    // 9 April 2008 jdp
    // turn off capslock if on
    ClearKeyState(VK_CAPITAL);
	vnclog.Print(LL_ALL, VNCLOG("generating ctrl-alt-del\n"));

	// Fake a hotkey event to any windows we find there.... :(
	// Winlogon uses hotkeys to trap Ctrl-Alt-Del...
	PostMessage(HWND_BROADCAST, WM_HOTKEY, 0, MAKELONG(MOD_ALT | MOD_CONTROL, VK_DELETE));

	// Switch back to our original desktop
	if (old_desktop != NULL)
	{
			vncService::SelectHDESK(old_desktop);
		CloseDesktop(winlogon_desk);
	}
	return NULL;
}
开发者ID:FrantisekKlika,项目名称:UltraVncAsDll,代码行数:34,代码来源:vncservice.cpp


示例2: GetThreadDesktop

BOOL
vncService::SelectHDESK(HDESK new_desktop)
{
	// Are we running on NT?
	if (IsWinNT())
	{
		HDESK old_desktop = GetThreadDesktop(GetCurrentThreadId());

		DWORD dummy;
		char new_name[256];

		if (!GetUserObjectInformation(new_desktop, UOI_NAME, &new_name, 256, &dummy)) {
			vnclog.Print(LL_INTERR, VNCLOG("!GetUserObjectInformation \n"));
			return FALSE;
		}

		vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK to %s (%x) from %x\n"), new_name, new_desktop, old_desktop);

		// Switch the desktop
		if(!SetThreadDesktop(new_desktop)) {
			vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK:!SetThreadDesktop \n"));
			return FALSE;
		}

		return TRUE;
	}

	return TRUE;
}
开发者ID:FrantisekKlika,项目名称:UltraVncAsDll,代码行数:29,代码来源:vncservice.cpp


示例3: GetThreadDesktop

BOOL
vncService::SelectHDESK(HDESK new_desktop)
{
	// Are we running on NT?
	if (IsWinNT())
	{
		HDESK old_desktop = GetThreadDesktop(GetCurrentThreadId());

		DWORD dummy;
		char new_name[256];

		if (!GetUserObjectInformation(new_desktop, UOI_NAME, &new_name, 256, &dummy)) {

			return FALSE;
		}



		// Switch the desktop
		if(!SetThreadDesktop(new_desktop)) {

			return FALSE;
		}

		// Switched successfully - destroy the old desktop
		CloseDesktop(old_desktop);

		return TRUE;
	}

	return TRUE;
}
开发者ID:isaudits,项目名称:scripts,代码行数:32,代码来源:vncService.cpp


示例4: SwitchInputDesktop

bool SwitchInputDesktop()
{
    BOOL	bRet = false;
    DWORD	dwLengthNeeded;

    HDESK	hOldDesktop, hNewDesktop;
    char	strCurrentDesktop[256], strInputDesktop[256];

    hOldDesktop = GetThreadDesktop(GetCurrentThreadId());
    memset(strCurrentDesktop, 0, sizeof(strCurrentDesktop));
    GetUserObjectInformation(hOldDesktop, UOI_NAME, &strCurrentDesktop, sizeof(strCurrentDesktop), &dwLengthNeeded);


    hNewDesktop = OpenInputDesktop(0, FALSE, MAXIMUM_ALLOWED);
    memset(strInputDesktop, 0, sizeof(strInputDesktop));
    GetUserObjectInformation(hNewDesktop, UOI_NAME, &strInputDesktop, sizeof(strInputDesktop), &dwLengthNeeded);

    if (lstrcmpi(strInputDesktop, strCurrentDesktop) != 0)
    {
        SetThreadDesktop(hNewDesktop);
        bRet = true;
    }
    CloseDesktop(hOldDesktop);

    CloseDesktop(hNewDesktop);


    return bRet;
}
开发者ID:xinba123,项目名称:shell,代码行数:29,代码来源:until.cpp


示例5: InputDesktopSelected

bool InputDesktopSelected()
{

	DWORD dummy;
	char threadname[256];
	char inputname[256];
	HDESK threaddesktop = GetThreadDesktop(GetCurrentThreadId());
	HDESK inputdesktop = OpenInputDesktop(0, FALSE,
				DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW |
				DESKTOP_ENUMERATE | DESKTOP_HOOKCONTROL |
				DESKTOP_WRITEOBJECTS | DESKTOP_READOBJECTS |
				DESKTOP_SWITCHDESKTOP | GENERIC_WRITE);

	if (inputdesktop == NULL) return FALSE;
	if (!GetUserObjectInformation(threaddesktop, UOI_NAME, &threadname, 256, &dummy)) {
			CloseDesktop(inputdesktop);
			return FALSE;
		}
	if (!GetUserObjectInformation(inputdesktop, UOI_NAME, &inputname, 256, &dummy)) {
			CloseDesktop(inputdesktop);
			return FALSE;
		}	
	CloseDesktop(inputdesktop);
	
	if (strcmp(threadname, inputname) != 0)
		{
			//if (strcmp(inputname, "Screen-saver") == 0)
			{
				return SelectDesktop();
			}
			return FALSE;
		}
	return TRUE;
}
开发者ID:runsoftcorp,项目名称:runremote,代码行数:34,代码来源:uvnckeyboardhelper.cpp


示例6: GetThreadDesktop

BOOL
vncService::SelectHDESK(HDESK new_desktop)
{
	// Are we running on NT?
	if (IsWinNT())
	{
		HDESK old_desktop = GetThreadDesktop(GetCurrentThreadId());
		//You do not need to call the CloseDesktop function to close the returned handle.

		DWORD dummy;
		char new_name[256];

		if (!GetUserObjectInformation(new_desktop, UOI_NAME, &new_name, 256, &dummy)) {
			return FALSE;
		}

		//vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK to %s (%x) from %x\n"), new_name, new_desktop, old_desktop);
		
		// Switch the desktop
		if(!SetThreadDesktop(new_desktop)) 
		{
			return FALSE;
		}

		return TRUE;
	}

	return TRUE;
}
开发者ID:uvbs,项目名称:SupportCenter,代码行数:29,代码来源:vncservice.cpp


示例7: Process_Desktop

/*************************************************
 * Create a new Desktop and run a Process in it. *
 * (Win NT+).                                    *
 *************************************************/
int DLL_EXP_IMP WINAPI Process_Desktop(char *szDesktopName, char *szPath)
{
	HDESK	hOriginalThread;
	HDESK	hOriginalInput;
	HDESK	hNewDesktop;

	// Save original ...
	hOriginalThread = GetThreadDesktop(GetCurrentThreadId());
	hOriginalInput = OpenInputDesktop(0, FALSE, DESKTOP_SWITCHDESKTOP);

	// Create a new Desktop and switch to it
	hNewDesktop = CreateDesktop(szDesktopName, NULL, NULL, 0, GENERIC_ALL, NULL);
	SetThreadDesktop(hNewDesktop);
	SwitchDesktop(hNewDesktop);

	// Execute process in new desktop
	StartProcess(szDesktopName, szPath);

	// Restore original ...
	SwitchDesktop(hOriginalInput);
	SetThreadDesktop(hOriginalThread);

	// Close the Desktop
	CloseDesktop(hNewDesktop);

	return 0;
}
开发者ID:justdan96,项目名称:VNCappWrapper,代码行数:31,代码来源:WinLockDLL.c


示例8: SimulateCtrlAltDelThreadFn

void *
SimulateCtrlAltDelThreadFn(void *context)
{
	HDESK old_desktop = GetThreadDesktop(GetCurrentThreadId());

	// Switch into the Winlogon desktop
	if (!vncService::SelectDesktop("Winlogon"))
	{
		vnclog.Print(LL_INTERR, VNCLOG("failed to select logon desktop\n"));
		return FALSE;
	}

	vnclog.Print(LL_ALL, VNCLOG("generating ctrl-alt-del\n"));

	HWND hwndCtrlAltDel = FindWindow("SAS window class", "SAS window");
	if (hwndCtrlAltDel == NULL) {
		vnclog.Print(LL_INTERR, VNCLOG("\"SAS window\" not found\n"));
		hwndCtrlAltDel = HWND_BROADCAST;
	}

	PostMessage(hwndCtrlAltDel, WM_HOTKEY, 0, MAKELONG(MOD_ALT | MOD_CONTROL, VK_DELETE));

	// Switch back to our original desktop
	if (old_desktop != NULL)
		vncService::SelectHDESK(old_desktop);

	return NULL;
}
开发者ID:bk138,项目名称:CollabTool,代码行数:28,代码来源:vncService.cpp


示例9: SelectDesktop

bool SelectDesktop()
{
		HDESK desktop;
		HDESK old_desktop;
		DWORD dummy;
		char new_name[256];
		desktop = OpenInputDesktop(0, FALSE,
				DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW |
				DESKTOP_ENUMERATE | DESKTOP_HOOKCONTROL |
				DESKTOP_WRITEOBJECTS | DESKTOP_READOBJECTS |
				DESKTOP_SWITCHDESKTOP | GENERIC_WRITE);
		if (desktop == NULL) return FALSE;
		old_desktop = GetThreadDesktop(GetCurrentThreadId());
		if (!GetUserObjectInformation(desktop, UOI_NAME, &new_name, 256, &dummy)) {
			CloseDesktop(desktop);
			return FALSE;
		}
		if(!SetThreadDesktop(desktop)) {
			CloseDesktop(desktop);
			return FALSE;
		}
		CloseDesktop(old_desktop);			
		return TRUE;

}
开发者ID:runsoftcorp,项目名称:runremote,代码行数:25,代码来源:uvnckeyboardhelper.cpp


示例10: SimulateCtrlAltDelThreadFn

void SimulateCtrlAltDelThreadFn()
{
	HDESK old_desktop = GetThreadDesktop(GetCurrentThreadId());

	// Switch into the Winlogon desktop
	if (!vncService::SelectDesktop("Winlogon"))
	{
		//vnclog.Print(LL_INTERR, VNCLOG("failed to select logon desktop\n"));
		Log.WinError(_ERROR_, "failed to select logon desktop");
		if (!vncService::SelectDesktop("Default"))
		{
			Log.WinError(_ERROR_, "failed to select default desktop");
		}
	}

	//vnclog.Print(LL_ALL, VNCLOG("generating ctrl-alt-del\n"));

	// Fake a hotkey event to any windows we find there.... :(
	// Winlogon uses hotkeys to trap Ctrl-Alt-Del...
	PostMessage(HWND_BROADCAST, WM_HOTKEY, 0, MAKELONG(MOD_ALT | MOD_CONTROL, VK_DELETE));

	// Switch back to our original desktop
	if (old_desktop != NULL)
		vncService::SelectHDESK(old_desktop);
}
开发者ID:uvbs,项目名称:SupportCenter,代码行数:25,代码来源:vncservice.cpp


示例11: sizeof

/* retrieve the desktop name to use if not specified on the command line */
static const WCHAR *get_default_desktop_name(void)
{
    static const WCHAR desktopW[] = {'D','e','s','k','t','o','p',0};
    static const WCHAR defaultW[] = {'D','e','f','a','u','l','t',0};
    static const WCHAR explorer_keyW[] = {'S','o','f','t','w','a','r','e','\\','W','i','n','e','\\',
                                          'E','x','p','l','o','r','e','r',0};
    static WCHAR buffer[MAX_PATH];
    DWORD size = sizeof(buffer);
    HDESK desk = GetThreadDesktop( GetCurrentThreadId() );
    WCHAR *ret = NULL;
    HKEY hkey;

    if (desk && GetUserObjectInformationW( desk, UOI_NAME, buffer, sizeof(buffer)/sizeof(WCHAR), NULL ))
    {
        if (strcmpiW( buffer, defaultW )) return buffer;
    }

    /* @@ Wine registry key: HKCU\Software\Wine\Explorer */
    if (!RegOpenKeyW( HKEY_CURRENT_USER, explorer_keyW, &hkey ))
    {
        if (!RegQueryValueExW( hkey, desktopW, 0, NULL, (LPBYTE)buffer, &size )) ret = buffer;
        RegCloseKey( hkey );
    }
    return ret;
}
开发者ID:bpon,项目名称:wine,代码行数:26,代码来源:desktop.c


示例12: Thread_Desktop

/************************************************
 * Create a new Desktop and run a Thread in it. *
 * (Win NT+).                                   *
 ************************************************/
int DLL_EXP_IMP WINAPI Thread_Desktop(LPTHREAD_START_ROUTINE ThreadFunc, THREAD_DATA *td)
{
	HDESK	hOriginalThread;
	HDESK	hOriginalInput;
	HDESK	hNewDesktop;

	// Save original ...
	hOriginalThread = GetThreadDesktop(GetCurrentThreadId());
	hOriginalInput = OpenInputDesktop(0, FALSE, DESKTOP_SWITCHDESKTOP);

	// Create a new Desktop and switch to it
	hNewDesktop = CreateDesktop(td->szDesktopName, NULL, NULL, 0, GENERIC_ALL, NULL);
	SetThreadDesktop(hNewDesktop);
	SwitchDesktop(hNewDesktop);

	// Execute thread in new desktop
	td->hDesk = hNewDesktop;
	StartThread(ThreadFunc, td);

	// Restore original ...
	SwitchDesktop(hOriginalInput);
	SetThreadDesktop(hOriginalThread);

	// Close the Desktop
	CloseDesktop(hNewDesktop);

	return 0;
}
开发者ID:justdan96,项目名称:VNCappWrapper,代码行数:32,代码来源:WinLockDLL.c


示例13: do_InitialDesktop_child

void do_InitialDesktop_child(int i)
{
    HDESK hdesktop;
    HWINSTA hwinsta;
    WCHAR buffer[100];
    DWORD size;
    BOOL ret;

    if(TestResults[i].ExpectedWinsta == NULL)
    {
        trace("Process should have failed to initialize\n");
        return;
    }

    IsGUIThread(TRUE);

    hdesktop = GetThreadDesktop(GetCurrentThreadId());
    hwinsta = GetProcessWindowStation();

    ret = GetUserObjectInformationW( hwinsta, UOI_NAME, buffer, sizeof(buffer), &size );
    ok(ret == TRUE, "ret = %d\n", ret);
    ok(wcscmp(buffer, TestResults[i].ExpectedWinsta) == 0, "Wrong winsta %S insted of %S\n", buffer, TestResults[i].ExpectedWinsta);

    ret = GetUserObjectInformationW( hdesktop, UOI_NAME, buffer, sizeof(buffer), &size );
    ok(ret == TRUE, "ret = %d\n", ret);
    ok(wcscmp(buffer, TestResults[i].ExpectedDesktp) == 0, "Wrong desktop %S insted of %S\n", buffer, TestResults[i].ExpectedDesktp);
}
开发者ID:hoangduit,项目名称:reactos,代码行数:27,代码来源:desktop.c


示例14: GetThreadDesktop

BOOL
vncService::SelectHDESK(HDESK new_desktop)
{
	// Are we running on NT?
	if (IsWinNT())
	{
		HDESK old_desktop = GetThreadDesktop(GetCurrentThreadId());

		DWORD dummy;
		char new_name[256];

		if (!GetUserObjectInformation(new_desktop, UOI_NAME, &new_name, 256, &dummy)) {
			vnclog.Print(LL_INTERR, VNCLOG("GetUserObjectInformation() failed\n"));
			return FALSE;
		}

		vnclog.Print(LL_INTINFO, VNCLOG("SelectHDESK() to %s (%x) from %x\n"),
					 new_name, new_desktop, old_desktop);

		// Switch the desktop
		if(!SetThreadDesktop(new_desktop)) {
			vnclog.Print(LL_INTERR, VNCLOG("unable to SetThreadDesktop(), error=%d\n"), GetLastError());
			return FALSE;
		}

		// Switched successfully - destroy the old desktop
		if (!CloseDesktop(old_desktop))
			vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK failed to close old desktop %x, error=%d\n"), old_desktop, GetLastError());

		return TRUE;
	}

	return TRUE;
}
开发者ID:bk138,项目名称:CollabTool,代码行数:34,代码来源:vncService.cpp


示例15: SetUserDesktop

int SetUserDesktop( int mode )
{
    static HWINSTA hwinstaSave; 
    static HDESK hdeskSave; 
    static HWINSTA hwinstaUser; 
    static HDESK hdeskUser; 
	
	if(mode == 1) {
		hwinstaSave = GetProcessWindowStation(); 
		hdeskSave = GetThreadDesktop(GetCurrentThreadId()); 
		
		hwinstaUser = OpenWindowStation("WinSta0", FALSE, MAXIMUM_ALLOWED); 
		if (hwinstaUser == NULL) 
			return 0; 
		SetProcessWindowStation(hwinstaUser); 
		hdeskUser = OpenDesktop("Default", 0, FALSE, MAXIMUM_ALLOWED); 
		if (hdeskUser == NULL) { 
			SetProcessWindowStation(hwinstaSave); 
			CloseWindowStation(hwinstaUser); 
			return 0; 
		} 
		SetThreadDesktop(hdeskUser); 
	} 
	else if(mode == 0) {
		SetThreadDesktop(hdeskSave); 
		SetProcessWindowStation(hwinstaSave); 
		CloseDesktop(hdeskUser); 
		CloseWindowStation(hwinstaUser); 
	}
	
    return 0; 
} 
开发者ID:kilitary,项目名称:ss,代码行数:32,代码来源:desktop.cpp


示例16: TitleWindow

void TitleWindow (HWND hWnd)
{
   TCHAR *szTitle, *szName;
   UINT nBytes = 0;

   //
   // How long is the desktop name?
   //
   GetUserObjectInformation (GetThreadDesktop(GetCurrentThreadId()),
                             UOI_NAME,
                             (LPVOID)&nBytes, // not used since cbInfo is 0
                             0,
                             &nBytes);
   szName = (LPTSTR)GlobalAlloc (GPTR, nBytes);
   if (!szName)
   {
      return;
   }
   //
   // Now get the desktop name
   //
   GetUserObjectInformation (GetThreadDesktop(GetCurrentThreadId()),
                             UOI_NAME,
                             (LPVOID)szName,
                             nBytes,
                             &nBytes);
   //
   // Now make the window title
   //
   szTitle = (LPTSTR)GlobalAlloc (
           GPTR,
           (lstrlen(szAppName)+lstrlen(TEXT(" - "))) * sizeof(TCHAR) + nBytes);

   if (!szTitle)
   {
      GlobalFree (szName);
      return;
   }
   wsprintf (szTitle, TEXT("%s - %s"), szAppName, szName);
   SetWindowText (hWnd, szTitle);
   //
   // Cleanup
   //
   GlobalFree (szName);
   GlobalFree (szTitle);
}
开发者ID:mingpen,项目名称:OpenNT,代码行数:46,代码来源:switcher.c


示例17: sizeof

bool Opc_client_ae_DriverThread::StartProcess(char* pCommandLine, char* pWorkingDir)
{ 
	STARTUPINFO startUpInfo = { sizeof(STARTUPINFO),NULL,"",NULL,0,0,0,0,0,0,0,STARTF_USESHOWWINDOW,0,0,NULL,0,0,0};  

	nIndex = 1;
	
	if(strlen(pCommandLine) > 4)
	{
		char pUserInterface[nBufferSize+1];

		//printf("%s\n", pCommandLine);
		
		strcpy(pUserInterface, "Y");

		BOOL bUserInterface = (pUserInterface[0]=='y'||pUserInterface[0]=='Y'||pUserInterface[0]=='1')?TRUE:FALSE;
		char CurrentDesktopName[512];

		// set the correct desktop for the process to be started
		if(bUserInterface)
		{
			//startUpInfo.wShowWindow = SW_SHOW;
			startUpInfo.wShowWindow = SW_SHOWMINIMIZED;
			startUpInfo.lpDesktop = NULL;
		}
		else
		{
			HDESK hCurrentDesktop = GetThreadDesktop(GetCurrentThreadId());
			DWORD len;

			GetUserObjectInformation(hCurrentDesktop,UOI_NAME,CurrentDesktopName,MAX_PATH,&len);
			startUpInfo.wShowWindow = SW_HIDE;
			startUpInfo.lpDesktop = CurrentDesktopName;
		}

		// create the process

		DWORD dwCreateFlg  = 0;
		dwCreateFlg |= CREATE_NEW_CONSOLE;

		memset(pProcInfo + nIndex, 0, sizeof(PROCESS_INFORMATION));

		if(CreateProcess(NULL,pCommandLine,NULL,NULL,TRUE,dwCreateFlg,NULL,strlen(pWorkingDir)==0?NULL:pWorkingDir,&startUpInfo,pProcInfo + nIndex))
		{
			Sleep(100);
			return TRUE;
		}
		else
		{
			fprintf(stderr,"Failed to start program '%s', error code = %d\n", pCommandLine, GetLastError());
			fflush(stderr);
			return FALSE;
		}
	}
	else
	{
		return FALSE;
	}
}
开发者ID:jiajw0426,项目名称:easyscada,代码行数:58,代码来源:opc_client_aedriverthread.cpp


示例18: lstrcpy

BOOL COpenDesktop::_OpenDesktop(LPCWSTR szName)
{
	WCHAR pvInfo[128] = {0};
	if(szName != NULL)
	{
		lstrcpy((LPSTR)pvInfo, (LPCSTR)szName);
	}
	else
	{
		HDESK hActiveDesktop;
		DWORD dwLen;
		hActiveDesktop = OpenInputDesktop(DF_ALLOWOTHERACCOUNTHOOK, FALSE, MAXIMUM_ALLOWED);
		GetUserObjectInformation(hActiveDesktop, UOI_NAME, pvInfo, sizeof(pvInfo), &dwLen);
		CloseDesktop(hActiveDesktop);
	}
	
	m_hwinstaCurrent = GetProcessWindowStation();
	CheckPointer(m_hwinstaCurrent,FALSE);
	
    m_hdeskCurrent = GetThreadDesktop(GetCurrentThreadId());
	CheckPointer(m_hdeskCurrent,FALSE);
	
	// ´ò¿ªwinsta0
    m_hwinsta = OpenWindowStation(_T("winsta0"), FALSE,                          
									WINSTA_ACCESSCLIPBOARD   |
									WINSTA_ACCESSGLOBALATOMS |
									WINSTA_CREATEDESKTOP     |
									WINSTA_ENUMDESKTOPS      |
									WINSTA_ENUMERATE         |
									WINSTA_EXITWINDOWS       |
									WINSTA_READATTRIBUTES    |
									WINSTA_READSCREEN        |
									WINSTA_WRITEATTRIBUTES);
	CheckPointer(m_hwinsta,FALSE);
	
	
    if (!SetProcessWindowStation(m_hwinsta))
	{
		return FALSE;
    }
	
	// ´ò¿ªdesktop
    m_hdesk = OpenDesktop((LPSTR)pvInfo, 0, FALSE,                
							DESKTOP_CREATEMENU |
							DESKTOP_CREATEWINDOW |
							DESKTOP_ENUMERATE    |
							DESKTOP_HOOKCONTROL  |
							DESKTOP_JOURNALPLAYBACK |
							DESKTOP_JOURNALRECORD |
							DESKTOP_READOBJECTS |
							DESKTOP_SWITCHDESKTOP |
							DESKTOP_WRITEOBJECTS);
	CheckPointer(m_hdesk,FALSE);
	
	SetThreadDesktop(m_hdesk);

	return TRUE;
}
开发者ID:smallfishincup,项目名称:biyesheji,代码行数:58,代码来源:OpenDesktop.cpp


示例19: pem_passwd_cb

int pem_passwd_cb(char *buf, int size, int rwflag, void *userdata) {
    int result;
#if 0
    DWORD dwThreadId;
    HWINSTA hwinstaSave;
    HDESK hdeskSave;
    HWINSTA hwinstaUser;
    HDESK hdeskUser;

    buf[0]='\0'; /* empty the buffer */

    /* Save the window station and desktop */
    hwinstaSave=GetProcessWindowStation();
    if(!hwinstaSave)
        ioerror("GetProcessWindowStation");
    dwThreadId=GetCurrentThreadId();
    if(!dwThreadId)
        ioerror("GetCurrentThreadId");
    hdeskSave=GetThreadDesktop(dwThreadId);
    if(!hdeskSave)
        ioerror("GetThreadDesktop");

    /* Switch to WinSta0/Default */
    hwinstaUser=OpenWindowStation("winsta0", FALSE, MAXIMUM_ALLOWED);
    if(!hwinstaUser)
        ioerror("OpenWindowStation");
    if(!SetProcessWindowStation(hwinstaUser))
        ioerror("SetProcessWindowStation");
    hdeskUser=OpenDesktop("Default", 0, FALSE, MAXIMUM_ALLOWED); /* Winlogon */
    if(!hdeskUser)
        ioerror("OpenDesktop");
    if(!SetThreadDesktop(hdeskUser))
        ioerror("SetThreadDesktop");
#endif

    /* Display the dialog box */
    section=userdata;
    result=DialogBox(ghInst, TEXT("PassBox"), hwnd, (DLGPROC)pass_proc);

#if 0
    /* Restore window station and desktop */
    if(!SetThreadDesktop(hdeskSave))
        ioerror("SetThreadDesktop");
    if(!SetProcessWindowStation(hwinstaSave))
        ioerror("SetProcessWindowStation");
    if(!CloseDesktop(hdeskUser))
        ioerror("CloseDesktop");
    if(!CloseWindowStation(hwinstaUser))
        ioerror("CloseWindowStation");
#endif

    if(!result)
        return 0;
    strncpy(buf, passphrase, size);
    buf[size - 1] = '\0';
    return strlen(buf);
}
开发者ID:djs55,项目名称:stunnel,代码行数:57,代码来源:gui.c


示例20: check_winsta

static BOOL CALLBACK
check_winsta(wchar_t* winsta_name, LPARAM)
{
    debug(L"entering enum_winsta_proc, winsta_name = %s\n", winsta_name);

    // open the window station and connect to it
    // (TODO: figure out what permissions are really needed here)
    //
    HWINSTA winsta = OpenWindowStation(winsta_name, FALSE, MAXIMUM_ALLOWED);
    if (winsta == NULL) {
        debug(L"OpenWindowStation error: %u\n", GetLastError());
        return TRUE;
    }
    HWINSTA old_winsta = GetProcessWindowStation();
    if (SetProcessWindowStation(winsta) == FALSE) {
        debug(L"SetProcessWindowStation error: %u\n", GetLastError());
        if (CloseWindowStation(winsta) == FALSE) {
            debug(L"CloseWindowStation error: %u\n", GetLastError());
        }
        return TRUE;
    }
    if (CloseWindowStation(old_winsta) == FALSE) {
        debug(L"CloseWindowStation error: %u\n", GetLastError());
    }

    // open the "default" desktop and connect to it (if present)
    // (TODO: figure out what permissions are really needed here)
    //
    HDESK desktop = OpenDesktop(L"default", 0, FALSE, MAXIMUM_ALLOWED);
    if (desktop == NULL) {
        debug(L"OpenDesktop error: %u\n", GetLastError());
        return TRUE;
    }
    HDESK old_desktop = GetThreadDesktop(GetCurrentThreadId());
    if (SetThreadDesktop(desktop) == FALSE) {
        debug(L"SetThreadDesktop error: %u\n", GetLastError());
        if (CloseDesktop(desktop) == FALSE) {
            debug(L"CloseDesktop error: %u\n", GetLastError());
        }
        return TRUE;
    }
    if (CloseDesktop(old_desktop) == FALSE) {
        debug(L"CloseDesktop error: %u\n", GetLastError());
    }

    // check_this_winsta() returns TRUE if it found the pid, FALSE if not
    //
    BOOL found = check_this_winsta();
    if (found) {
        SetLastError(ERROR_SUCCESS);
    }
    // return TRUE to keep searching
    return ! found;
}
开发者ID:blueskyll,项目名称:condor,代码行数:54,代码来源:condor_softkill.WINDOWS.cpp



注:本文中的GetThreadDesktop函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetThreadId函数代码示例发布时间:2022-05-30
下一篇:
C++ GetThreadContext函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap