sgp wrote  (on 19.03.2007 11:37):
>
> I want to match the running window with an expression =(expr) but when I
> do, all my buttons change to the new icon. I think it's because I can't
> figure out how to reference the handle of the window that is associated
> with the active button. Here's what I have for the name field
>
Hi sgp,

I was scanning the messages today and I saw your message, too. I thought 
this might be what you're looking for, you can change the icon of any 
matching window (single or multiple).

HTH

; changes the window icons of all windows matching the given caption list
@ChangeWindowIcon
    args _cl, _icon_path
    if(not _icon_path or not file.validpath(_icon_path))do
        MessageBox("ok warning", "icon path ("++_icon_path++") invalid", 
"@ChangeWindowIcon")
        quit(1)
    endif
    if(_cl eq "")do
        MessageBox("ok warning", "caption list ("++_cl ++") invalid", 
"@ChangeWindowIcon")
        quit(1)
    endif

    local dll_status, _icon_handle, _null, _handles, i
    local IMAGE_ICON = 1
    local LR_LOADFROMFILE = 0x10
    local WM_SETICON = 0x80
    local ICON_SMALL = 0

    _handles = win.handlelist(_cl)
    _icon_handle = dll.call("LoadImage|l s ui i i ui", _null, 
_icon_path, IMAGE_ICON, _null, _null, LR_LOADFROMFILE)

    for(i = 1; i <= word(_handles, 0); i++)
        dll.call("SendMessage|l l l l", word(_handles, i), WM_SETICON, 
ICON_SMALL, _icon_handle)
    endfor
    quit

Reply via email to