Title : Disapointing Icons in CW using dll Bug : Icons is gone after calling a function in another cw dll file Author: The Icon Guy Tom Jorgensen, SMS Development & Support AS, www.sms.no - hotdogs@hotmail.com ! ==================================================================== case 1 ! ==================================================================== You have a function called hlp_abt (Help About) placed in a common dll You want the window to have an icon but dont want the minimize _ thingie on the caption bar. So you include an icon 1X.ICO in your project and set SYSTEM{PROP:ICON} = '~1X.ICO' !Change System Icon just before you OPEN the window But when you are calling this function from another dll the icon is not there the first time it opens, you get the infamous Clarion Foot-on-a-Rug icon instead. The trix here is to just OPEN and then CLOSE a dummy window before opening the window. This can be implementet as a class and be done for every window if you like, in this example its done in the PrepareProcedure routine as WF.ReInitWin !The OpenCloseTrix This trix seems to re-initialize your system icon. ! -------------------------------------------------------------------- ! global stuff for the dll ! -------------------------------------------------------------------- WinFunc CLASS,Type ReInitWin PROCEDURE END WF WinFunc WinFunc.ReInitWin PROCEDURE ! -------------------------------------------------------------------- ! the DummyWindow ! -------------------------------------------------------------------- MyWin WINDOW('Wait'),AT(,,28,0),GRAY END CODE OPEN(MyWin) CLOSE(MyWin) RETURN ! -------------------------------------------------------------------- ! -------------------------------------------------------------------- ! the Help About procedure ! -------------------------------------------------------------------- Hlp_Abt PROCEDURE() HelpWindow WINDOW('About'),AT(,,173,83),CENTER,GRAY STRING('...'),AT(65,3,100,10),USE(?String1) STRING('...'),AT(65,18,100,10),USE(?String2) STRING('...'),AT(65,28,100,10),USE(?String3) STRING('...'),AT(65,38,100,10),USE(?String4) STRING('...'),AT(65,48,100,10),USE(?String5) STRING('...'),AT(65,58,100,10),USE(?String6) BUTTON('OK'),AT(65,69,44,12),USE(?OK) END CODE DO PrepareProcedure ACCEPT CASE EVENT() END CASE FIELD() OF ?Ok CASE EVENT() OF EVENT:Accepted POST(Event:CloseWindow) END END END DO ProcedureReturn !--------------------------------------------------------------------------- PrepareProcedure ROUTINE WF.ReInitWin !The OpenCloseTrix SYSTEM{PROP:ICON} = '~1X.ICO' !Change System Icon OPEN(HelpWindow) DISPLAY !--------------------------------------------------------------------------- ProcedureReturn ROUTINE CLOSE(HelpWindow) RETURN ! ==================================================================== ! case 2 ! ==================================================================== You have a form, with an option containing 10 radiobuttons. Selecting from the different radios changes an image on the form, giving you a visualization of your choice. cool. On the form, you also have a lookup, which is looking up by calling a Browse found in another dll. Say you select radio1 - your image change to image1 - then you call the lookup and when you return your imahe is still image1. BUT if you now select radio2 or radio3 these icons are gone - as well as if you reselect radio1 again. How did I fix this? I created a dummywindow again (called wIcons), this time within the procedure(form) containing all the 10 icons I was using. BTW, this is also an excelent way of including them in the project - makeing sure they are the correct ones. Then after doing the lookup, I just OPEN(wIcons) CLOSE(wIcons) and this trix did reload the icon resources from the dll file. Since theres no ACCEPT or DISPLAY in between, you never see the opening... ! --------------------------------------------------------------------