0

I am constantly finding myself in this edge case of, not being able to identify a perticular window reliably.

I am tired of relying on the devoloper to give their software a title bar with meaningfull information. So I have set out to solve this. After much searching and reading. I have arrived upon:

~Browser_Back & space::
WM_SETICON := 0x80
ICON_SMALL := 0
ICON_BIG := 1
IMAGE_ICON := 1

$F1::
   hIcon := LoadPicture("Shell32.dll", "Icon5", IMAGE_ICON)
   SendMessage, WM_SETICON, ICON_SMALL, hIcon,, A
   SendMessage, WM_SETICON, ICON_BIG, hIcon,, A
   Return

It will change the active windows icon.

Its not my code, I found it HERE. It works very reliably.

I want to build upon this, Is there a way for Authotkey to work with a window based on its current icon? Commands like

  • #IfWinActive
  • #If
  • If

etc etc can work on a windows title and controls but what about its icon?

I searched as much as I could on this topic and turned up with nothing.

Any help would be really wellcome

  • 1
    Seems like a fair assumption that [`WM_GETICON`](https://learn.microsoft.com/en-us/windows/win32/winmsg/wm-geticon) exists (though there's [this caveat](https://stackoverflow.com/questions/24047470/wm-geticon-not-working-windows)). So you'd iterate over all windows and find the one with the icon you want. – Ouroborus Dec 27 '22 at 01:04
  • 1
    Your solution seems very exotic (read: bad). As opposed to making changes windows' icons, seems like to me you might as well just store the windows' hwnd's to distinguish them. – 0x464e Dec 28 '22 at 18:27
  • @0x464e I bit more than I can chew I think, I will heed your advice and live to fight another day :). Thanks! – hellen_dorandt89 Jan 03 '23 at 01:58
  • @Ouroborus Good find, seems intresting, I will keep it around for the future, thanks. – hellen_dorandt89 Jan 03 '23 at 01:58
  • @0x464e The question is about how to find a window by its icon. – Ouroborus Jan 03 '23 at 05:16
  • @Ouroborus which is why I commented a suggestion and didn't post an answer. Icon shenanigans here seem completely unnecessary/the wrong tool for the job. Storing HWND's would be way more straight forward/intended. – 0x464e Jan 03 '23 at 09:18

0 Answers0