Q: Icon refresh behavior?

Started by Mark Jones, July 03, 2005, 06:20:01 PM

Previous topic - Next topic

Mark Jones

Hi, I'm working on a "dialog as main" project and added an icon to it:


IDI_SMALL           equ 5

WinMain proc hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:DWORD
    LOCAL   wc:WNDCLASSEX
    LOCAL   msg:MSG

    mov     wc.cbSize,sizeof WNDCLASSEX
    mov     wc.style,CS_HREDRAW or CS_VREDRAW
    mov     wc.lpfnWndProc,offset WndProc
    mov     wc.cbClsExtra,NULL
    mov     wc.cbWndExtra,DLGWINDOWEXTRA
    push    hInst
    pop     wc.hInstance
    mov     wc.hbrBackground,COLOR_BTNFACE+1
    mov     wc.lpszClassName,offset ClassName
    invoke  LoadIcon,hInstance,IDI_SMALL
    mov     wc.hIcon,eax
    mov     wc.hIconSm,eax
    invoke  LoadCursor,NULL,IDC_ARROW
    mov     wc.hCursor,eax
    invoke  RegisterClassEx,addr wc
    invoke  CreateDialogParam,hInstance,IDD_DIALOG,NULL,addr WndProc,NULL
    invoke  ShowWindow,hWnd,SW_SHOWNORMAL
    invoke  UpdateWindow,hWnd
    .while  TRUE
        invoke GetMessage,addr msg,NULL,0,0
    .BREAK .if !eax
        invoke TranslateMessage,addr msg
        invoke DispatchMessage,addr msg
    .endw
    mov     eax,msg.wParam
    ret
WinMain endp



5 icon discardable "Res/myicon.ico"


It compiles and operates as expected. Except, if you edit the icon file and recompile, the new icon is not loaded. I have to comment out the .RC line, recompile, remove the comment, and compile again to load the edited icon. Is this a limitation of the microsoft tools or am I doing something wrong? Thanks. :)
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

KetilO

Hi

Recompiling resources before building should be enough.

KetilO

Mark Jones

Oh I see, "GO" doesn't rebuild the resources. Gotcha! :U
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

KetilO

Go does rebuild resources if any dialog, menu or rc file is changed.

KetilO

Mark Jones

Err that's what I meant. I think I drank too much last night... :dazzled: :bg
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08