Getting rid of that ugly Console Window
We now have a fully functional GUI for our application, except that we still have that console window right in the middle. This is not only annoying, but also dangerous; if the user closes the console window the application aborts. However, because the main window of our GUI is an out-of-process ActiveX object, this object is not shut down with the application. If the user attempts to close the main GUI window after closing the console window, the CMain ActiveX object will disappear from the screen, but will remain loaded in memory robbing system resources. You could easily verify this by opening Windows Task Manager (if you are using Windows NT/2000). So we need a way to get rid of the console window. Doing this is fairly standard, although you need to understand a few concepts of Windows programming. We won’t explain these concepts here, because most Fortran compilers include at least some basic description of how to create Windows programs in their manuals. If yours doesn’t, you can refer to any of the many available books on Windows programming.
The trick to convert our main program into a full Windows application is to encapsulate the code of the program into a WinMain function. The rest is done by your compiler when you compile/link the program. Doing this usually involves a certain amount of compiler-specific instructions. Sample Code 19b shows the final application wrapped into a WinMain function for the Compaq Visual Fortran compiler. You will find the same code for Lahey Fortran 95 in Sample Code 19c, and for Absoft Pro Fortran in Sample Code 19a. The links below also give you instructions to compile and link the final application using the different Fortran compilers supported by f90VB:
Instructions to compile MainWin with Absoft Pro Fortran
Instructions to compile MainWin with Compaq Visual Fortran
Instructions to compile MainWin with Lahey Fortran 95