# Using GCC: the first Win32 program

## The first programs:

Edit a new file and type:

    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    LPSTR lpCmdLine, int nCmdShow)
    {
    	MessageBox (NULL, "Hello Win32", "First App", MB_OK);
    return 0;
    }

Save this file as 'test.c'.

Just compile you programs with

    gcc -Zwin32 test.c

and you will get the Win32 program test.exe.

## Other sample programs:

Note: The sample directories contains a RSXIDE project file.

RSXNT contain the following samples in the subdirectories of \rsxnt\sample. All examples can be compiled with the tool make.exe. The makefiles are written for GNU make. For NT09C users there is the newest version (3.75) in the directory \RSXNT\BINNT09C.

Console:

This samples cannot run under Win32s.

ANSI | uses ANSI/VT100 control strings
ARGVENV | bound program that also uses Win32 functions
EXCPT | exception demo
FINDFIRST | prints directory list, uses new findfirst, support of LFN under DOS
FORK | program that uses fork()
PIPE | test pipes, executes read and write process
SOCKET | unix sockets, win32 sockets
THREAD | multithread program that uses beginthread()
VIDEO | demo of the new video library

GUI:

All samples can run under WinNT, Win95 and Win32s.

COMMCTL | Common control example
CPLUS | C++ code example
CTL3D | Dialog example
DIBVWR | DIB Viewer (by Alfons Hoogervorst)
ENUMW | Callbacks example
SOL | Game
SPEED | Speed test
WINDOWED | Text mode program in a window
WINEDIT | Rich text format editor

DLL:

All samples can run under WinNT, Win95 and Win32s.

DLLNRT | DLL that does not use RSXNT.DLL functions (no file I/O)
DLLCRT | DLL that uses the CRT DLL (enables all C functions)
DLLSO | DLL (stand-alone), can be used without RSXNT.DLL

## Running make to build samples:

The makefiles are written to use GNU make. If you want to use Borland or MS make you must modify the makefile to include the rsxntmak.msc makefile.

Example:

! include <..\..\rsxntmak.msc>

In most cases you can build the standard executable or you can link the C runtime DLL to the application:

a) make

b) make crt=1 multi=1 debug=1

Possible switches:

crt=1 | uses C runtime DLL
sys=1 | use System Library
multi=1 | build multithread application
dual=1 | build dual-mode application (Win32 and DOS)
debug=1 | include debugging symbols