RE: Binding & Icons
- Posted by Brian Broker <bkb at cnw.com> May 02, 2002
- 414 views
Ah yes, that reminds me of my fix that I hope Derek implements (my changes are marked by --BKB: in Win32Lib_full.ew: --------------------------------------------------------------------- procedure registerClass( atom szClassName ) -- register the application class atom wndClassEx --BKB begin (added) atom exw exw = allocate_string("exw") --BKB end -- get some memory for the window class structure wndClassEx = acquire_mem(0, SIZEOF_WNDCLASSEX) -- build the structure store( wndClassEx, winExSize, SIZEOF_WNDCLASSEX) store( wndClassEx, winExStyle, or_all(vWindowClassStyle)) store( wndClassEx, winExProc, WndProcAddress) store( wndClassEx, winExClsExtra, 0) store( wndClassEx, winExExtra, 0) store( wndClassEx, winExInstance, instance()) --BKB begin (modified) store( wndClassEx, winExIcon, w32Func( xLoadIcon, { instance(), exw } ) ) --BKB end store( wndClassEx, winExCursor, w32Func( xLoadCursor, { NULL, IDC_ARROW } ) ) store( wndClassEx, winExBackground, WindowColor+1 ) store( wndClassEx, winExMenuName, NULL) store( wndClassEx, winExClassName, szClassName ) --BKB begin (modified) store( wndClassEx, winExIconSm, w32Func( xLoadIcon, { instance(), exw } ) ) --BKB end if w32Func( xRegisterClassEx, { wndClassEx } ) = 0 then abortErr( Err_REGCLASS ) end if --BKB begin (added) free(exw) --BKB end -- Free structure release_mem( wndClassEx ) end procedure --------------------------------------------------------------------- With this fix in place, you only need to use setIcon(Win,"some.ico") for unbound programs, and it doesn't hurt if you leave that line in your bound program... Now your icon shows in the window title bar, the system tray, *and* the alt-tab window. Not sure why Derek decided to hold off on adding this... -- Brian Wolf wrote: > > has anyone noticed that when you press Alt+Tab to show you current > > running applications Eu app don't display their icons? > > When i bind my app and run it and press Alt+tab ....i still see the icon > > > > IDI_APPLICATION instead of the icon i used when binding my APP > > ...methinks, when you hit ALT + TAB, what's shown is the icon in the > program's title bar, > *not* the icon that Explorer shows. > To get your icon into the title bar using win32lib, you'll have to use > some code in your startup routine, for example: > > procedure start_up() > atom jk > -- get the icon from your .exe' > jk = w32Func(xLoadIcon,{instance(),allocate_string("exw")}) > -- and insert it in the program's title bar. > jk = sendMessage(YourWin,WM_SETICON, 1, jk) > > ... where 'YourWin' is your 'WinMain' id > >