函数参考


_WinAPI_GetThreadDesktop

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 值.

注意/说明

You do not need to call the _WinAPI_CloseDesktop() function to close the returned handle.

相关

详情参考

在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