How to use the main Window in a Visual Fortran SDI application

How to use the main Window in a Visual Fortran SDI application

Dear all,

I'm currently using Vis.Fortran 6.1a. I've done a lot of Quickwin programming and learned how to write or fraw to quickwin child windows.

Now I have to port some functions to a SDI or MDI envirnment. I have menus and toolbars including tooltips working nicely, but I do not find any way to use the remaining blank area for text or graphics output. I would prefer to open it as a Fortran logical unit and just to make formatted write to it, but any other way would also be welcome.

All examples seem to use the Quickwin functions. Even when I try to open a paint structure, with EndPaint I get a compiler error that Quickwin may not be used in a console application.

Maybe I just understand something completely wrong?


6 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

When you register your window class, you assign a window
procedure (e.g. MainWndProc) which should handle your
WM_PAINT commands for any window that you subsequently
create of that class.
These commands are issued e.g. after
invalidating the client window e.g.


where hWnd is the window handle and rc is a T_RECT
structure to store the co-ords of the corners of
the window.

After getting a handle, hWndDC, to a drawing context
and creating a paint structure, ps, using BeginPaint, e.g.


Your WM_PAINT handler should then call the routine (here called IGPLOT)
that does all your drawing using commands such as e.g.

retlog=MSFWIn$LineTo(hWndDC,IXEND(K), IYEND(K))

where you supply hWndDC, the handle to a drawing context.
Put your text output in another routine and call
it as well. BeginPaint creates a paint structure, ps, which should
then be destroyed by a call to EndPaint when drawing is complete. HTH.

Thanks a lot. Now it works. It was the invalidation that was missing.


Once you figure out principles of drawing/WM_PAINT, you may want to look at my XFTGDI module. Although it's not source-level compatible with QuickWin routines, I believe you'll find it more similar and easier to use than pure APIs.


Thank you for that tip. While unfortuantely the example project does not compile under VF6.1a and exits with too many errors, looking into the code immediately helped with another question. I will keep the source holy and use it as primary "how to" source.

While the documentation of VisualFortran is enourmous, it still only covers a microscopic part of this extremely powerfull language.

Thanks again for both posts.


Sorry for inconvenience; there are notes in XFT*.f90 about portability across various CVF versions. All errors are consequence of Windows API symbols redefined/undefined, because DFWIN(TY) modules are different.

I've never had 6.1a, but on 6.6a the following helps (on 6.1 will be something similar):
- Delete declarations of IMAGE_* and LR_* from XFTGDI; (but leave INTERFACE to LoadImageA)
- Delete declarations of OFN_EXPLORER from XFTFile.

Guess I'll fix the samples to use !DEC$IF DEFINED directives, so the code would be compilable just in few steps. XFT full has a private subset of API declarations (i.e. it doesn't USE DFWIN at all), so it won't be issue there; I didn't want to burden lite version with it.


Leave a Comment

Please sign in to add a comment. Not a member? Join today