> On 11.11.2010, at 13:16, Shuiling wrote:
> > Hi FLTK users,
> >
> > I want to change the window icon in Windows and the compiler I use is 
> > VS2008. According the tip in FLTK documentation - "Setting the Icon of a 
> > Window"(link: http://www.fltk.org/doc-1.1/osissues.html), but it does not 
> > work.
> >
> > The related files in setting the icon of a window are:
>
> [...]
>
>
> > Before the FLTK window showed, I invoke the icon() method, the code snippet:
> >
> > mainWindow->icon((char *)LoadIcon(fl_display, MAKEINTRESOURCE(IDI_ICON)));
> > mainWindow->show();
> >
> > I don't know whether which step I go wrong. Whether I get a MSDOS Console 
> > Window or not, the window icon still doesn't change.
>
> I can imagine two problems with your code:
>
> (1) the docs (cited by you above) state:
>
>     "You must call Fl_Window::show(argc, argv) for the icon to be used.
>     The Fl_Window::show() method does not bind the icon to the window."
>
> Change this first to see if it works (you need to change your main()
> function arguments if you don't have argc and argv included).
>
> Note: I'm not sure that this is really needed, since I saw it work w/o
> argc and argv, too (FLTK 1.3). Maybe the docs are not correct...
>
>
> (2) you must add the resource file to your project, but I can't tell
> you how to do this with VC2008 :-( . To test if it worked, you could
> try to change your code like this:
>
>    char *my_icon = (char *)LoadIcon(fl_display, MAKEINTRESOURCE(IDI_ICON));
>    // print/debug here, what LoadIcon returned (must not be 0)
>    mainWindow->icon(my_icon);
>    mainWindow->show(argc,argv);
>
> Albrecht


Hi Albrecht,

 Thank you for your reply. I downloaded the source code of the latest FLTK 
release version, fltk-1.3.x, and compile the example, "sudoku" under VS2008 and 
VC6.0, but the window icon still unchanged. It's so strange.

Shuiling
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to