#include <FL/x.H>
Fltk MSWindows-specific interface

The <FL/x.H> header file defines the interface to fltk's MSWindows-specific functions. Be warned that some of the structures and calls in it are subject to change in future version of fltk. Try to avoid doing this so your code is portable.


Handling other MSWindows messages

A single WNDCLASSEX called "FLTK" is created. All Fl_Windows are of this class. This window class is created the first time Fl_Window::show() is called.

You can probably combine fltk with other libraries that make their own MSWindows window classes. The easiest way is to call Fl::wait(), it will call DispatchMessage for all messages to the other windows. If necessary you can let the other library take over (as long as it calls DispatchMessage()), but you will have to arrange for the function Fl::flush() to be called regularily (otherwise widgets will not update), and timeouts and the idle function will not work.

extern MSG fl_msg;

void Fl::add_handler(int (*f)(int));

HWND fl_xid(const Fl_Window*);

Fl_Window* fl_find(HWND xid)


Drawing things using the MSWindows GDI

When the virtual function Fl_Widget::draw() is called, fltk has stashed in some global variables all the silly extra arguments you need to make a proper GDI call. These are:

extern HINSTANCE fl_display;
extern HWND fl_window;
extern HDC fl_gc;
COLORREF fl_RGB();
HPEN fl_pen();
HBRUSH fl_brush();


How to not get a MSDOS console window

MSWindows has a really stupid mode switch stored in the executables that controls whether or not to make a console window (hint to Mr Gates: why not leave it hidden until the program prints something?).

To not produce a "console" window when you run your program add the following secret incantation to the Micro$oft linker:

        /SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup

Unfortunately this seems to completely disable stdin/stdout, even if you run the program from a console. So don't do this until you have debugged your program!


Other hints

I use capital C as the extension for c++ source code, for instace for Fluid output. Unfortunately there is no way to convince VC++ to use this except to tell it to compile *everything* using C++ by putting the switch "/TP" in the options. This makes it impossible to combine old C code and fltk code.


Known bugs

If program is deactivated, Fl::wait() does not return until it is activated again, even though many events are delivered to the program. This can cause idle background processes to stop unexpectedly. This also happens while the user is dragging or resizing windows or otherwise holding the mouse down. I was forced to remove most of the efficiency fltk uses for redrawing in order to get windows to update while being moved. This is a design error in MSWindows and probably impossible to get around.

Fl_Gl_Window::can_do_overlay() returns true until the first time it attempts to draw an overlay, and then correctly returns whether or not there is overlay hardware.

Cut text contains ^J rather than ^M^J to break lines. This is a feature, not a bug.

I can't seem to get SetCapture (used by Fl::grab()) to work, and I can't find a way to stop the main window title from turning gray while menus are popped up.

glpuzzle program does not animate unless you resize it first. Unknown why.

Fl_Window::fullscreen() not implemented (should take over the screen without a title bar). Currently does maximize instead.

Import .bmp files into fluid. Wonko has the specs.

Can't set icon of windows.