SwitchDesktop()后會自行跳出回到原界面這是為什么,有什么辦法留在生成的界面嗎?
uj5u.com熱心網友回復:
關閉原界面的explorer.exe行程再試試看。SwitchDesktop Function
Makes the specified desktop visible and activates it. This enables the desktop to receive input from the user. The calling process must have DESKTOP_SWITCHDESKTOP access to the desktop for the SwitchDesktop function to succeed.
BOOL WINAPI SwitchDesktop(
__in HDESK hDesktop
);
Parameters
hDesktop
A handle to the desktop. This handle is returned by the CreateDesktop and OpenDesktop functions.
This desktop must be associated with the current window station for the process.
Return Value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError. However, SwitchDesktop only sets the last error for the following cases:
When the desktop belongs to an invisible window station
When hDesktop is an invalid handle, refers to a destroyed desktop, or belongs to a different session than that of the calling process
Remarks
The SwitchDesktop function fails if the desktop belongs to an invisible window station. SwitchDesktop also fails when called from a process associated with a secured desktop, such as the WinLogon and ScreenSaver desktops.
Requirements
Client
Requires Windows Vista, Windows XP, Windows 2000 Professional, or Windows NT Workstation 3.51 and later.
Server
Requires Windows Server 2008, Windows Server 2003, Windows 2000 Server, or Windows NT Server 3.51 and later.
Header
Declared in Winuser.h; include Windows.h.
Library
Use User32.lib.
DLL
Requires User32.dll.
See Also
CreateDesktop
Desktops
OpenDesktop
Window Station and Desktop Functions
Send comments about this topic to Microsoft
Build date: 8/15/2007
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/75358.html
標籤:進程/線程/DLL
