Jump to content

Retrieving information of a windows upper right corner Icon.


Recommended Posts

So I found this function posted and I was wondering how I can actually get it's resource ordinal name instead of its handle, anyone done this before?

This will get the handle to an Icon from particular windows such as explorer windows, retrieving the folder icon displayed in upper right corner apparently..

#Include <GuiListView.au3>
#include <Array.au3>
Func getIconHandleByHwnd($hwnd)
    $hwnd = HWnd($hwnd)
    $WM_GETICON = 0x7F
    $GCL_HICONSM = -34
    $GCL_HICON = -14
    $IDI_APPLICATION = 32512
    Local $hIcon = 0
    $hIcon = _SendMessage ($hwnd, $WM_GETICON, False, 0)
    If ($hIcon == 0) Then $hIcon = _SendMessage ($hwnd, $WM_GETICON, True, 0)
    If ($hIcon == 0) Then
        $hIcon = DllCall("user32.dll", "int", "GetClassLong", "hwnd", $hwnd, "int", $GCL_HICONSM)
  _ArrayDisplay($hIcon)
        $hIcon = $hIcon[0]
    EndIf
    If ($hIcon == 0) Then
        $hIcon = DllCall("user32.dll", "int", "GetClassLong", "hwnd", $hwnd, "int", $GCL_HICON)
  _ArrayDisplay($hIcon)
        $hIcon = $hIcon[0]
    EndIf
    Return $hIcon
EndFunc   ;==>getIconHandleByHwnd
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...