Retrieves a handle to the desktop assigned to the specified thread.
#Include <WinAPIEx.au3>
_WinAPI_GetThreadDesktop ( $iThreadID )
$iThreadID | The thread identifier. The _WinAPI_CreateProcess() and _WinAPI_GetCurrentThreadID() return thread identifiers. |
Success | Handle to the desktop associated with the specified thread. |
失败: | 返回 0 并设置 @error 标志为非 0 值. |
在MSDN中搜索
#Include <APIConstants.au3>
#Include <WinAPIEx.au3>
Opt('MustDeclareVars', 1)
Global $hObj[2] = [_WinAPI_GetProcessWindowStation(), _WinAPI_GetThreadDesktop(_WinAPI_GetCurrentThreadID())]
For $i = 0 To 1
If Not $i Then
ConsoleWrite('-------------------------------' & @CR)
EndIf
ConsoleWrite('Handle: ' & $hObj[$i] & @CR)
ConsoleWrite('Type: ' & _WinAPI_GetUserObjectInformation($hObj[$i], $UOI_TYPE) & @CR)
ConsoleWrite('Name: ' & _WinAPI_GetUserObjectInformation($hObj[$i], $UOI_NAME) & @CR)
ConsoleWrite('-------------------------------' & @CR)
Next