Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <WindowsConstants.au3>
- #include <GUIConstants.au3>
- #include <WinAPI.au3>
- ;WinAPIEx.au3:
- Global Const $GCL_CBCLSEXTRA = -20
- Global Const $GCL_CBWNDEXTRA = -18
- Global Const $GCL_HBRBACKGROUND = -10
- Global Const $GCL_HCURSOR = -12
- Global Const $GCL_HICON = -14
- Global Const $GCL_HICONSM = -34
- Global Const $GCL_HMODULE = -16
- Global Const $GCL_MENUNAME = -8
- Global Const $GCL_STYLE = -26
- Global Const $GCL_WNDPROC = -24
- ; -Author: name22 (www.autoit.de)
- $hWnd = GUICreate("Searching...", 256, 256)
- GUISetState()
- $hDC_Window = _WinAPI_GetDC($hWnd)
- $aList = WinList()
- For $i = 1 To $aList[0][0]
- If BitAND(WinGetState($aList[$i][1]), 3) = 3 Then
- $hIcon = _SendMessage($aList[$i][1], $WM_GETICON, 2, 0, 0, Default, Default, "HANDLE")
- If Not $hIcon Then $hIcon = _SendMessage($aList[$i][1], $WM_GETICON, 0, 0, 0, Default, Default, "HANDLE")
- If Not $hIcon Then $hIcon = _WinAPI_GetClassLongEx($aList[$i][1], $GCL_HICON)
- If Not $hIcon Then $hIcon = _WinAPI_GetClassLongEx($aList[$i][1], $GCL_HICONSM)
- If $hIcon Then
- WinSetTitle($hWnd, "", $aList[$i][0])
- _SendMessage($hWnd, $WM_ERASEBKGND, $hDC_Window)
- _WinAPI_DrawIconEx($hDC_Window, 64, 64, $hIcon, 128, 128, 0, 0, 3)
- _WinAPI_DestroyIcon($hIcon)
- Sleep(1000)
- EndIf
- EndIf
- Next
- While True
- Switch GUIGetMsg()
- Case $GUI_EVENT_CLOSE
- ExitLoop
- EndSwitch
- WEnd
- ; #FUNCTION# ====================================================================================================================
- ; Name...........: _WinAPI_GetClassLongEx
- ; Description....: Retrieves the specified value associated with the specified window.
- ; Syntax.........: _WinAPI_GetClassLongEx ( $hWnd, $iIndex )
- ; Parameters.....: $hWnd - Handle to the window.
- ; $iIndex - The value to retrieve. This parameter can be one of the following values.
- ;
- ; $GCL_CBCLSEXTRA
- ; $GCL_CBWNDEXTRA
- ; $GCL_HBRBACKGROUND
- ; $GCL_HCURSOR
- ; $GCL_HICON
- ; $GCL_HICONSM
- ; $GCL_HMODULE
- ; $GCL_MENUNAME
- ; $GCL_STYLE
- ; $GCL_WNDPROC
- ;
- ; Return values..: Success - The requested value.
- ; Failure - 0 and sets the @error flag to non-zero.
- ; Author.........: Yashied
- ; Modified.......:
- ; Remarks........: None
- ; Related........:
- ; Link...........: @@MsdnLink@@ GetClassLong
- ; Example........: Yes
- ; ===============================================================================================================================
- Func _WinAPI_GetClassLongEx($hWnd, $iIndex)
- Local $Ret
- If @AutoItX64 Then
- $Ret = DllCall('user32.dll', 'ulong_ptr', 'GetClassLongPtrW', 'hwnd', $hWnd, 'int', $iIndex)
- Else
- $Ret = DllCall('user32.dll', 'ulong', 'GetClassLongW', 'hwnd', $hWnd, 'int', $iIndex)
- EndIf
- If (@error) Or (Not $Ret[0]) Then
- Return SetError(1, 0, 0)
- EndIf
- Return $Ret[0]
- EndFunc ;==>_WinAPI_GetClassLongEx
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement