Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The Guide to Clip-4-Win version 3.0 - <b>winsetup()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
WinSetup()
Register a new window class and create a window
------------------------------------------------------------------------------

Syntax
WinSetup( <cAppName>, <cTitle>, [ <nX> ], [ <nY> ],                  ;
          [ <nWidth> ], [ <nHeight> ], [ <cIcon> ], [ <cCursor> ],   ;
          [ <nBrush> ], [ <nStyle> ] )   -->   hWnd

Arguments
<cAppName> is the name of the window class to be registered.
You can use this later if you need to create a window of this
particular class.  Typically this will be the name of your
application, although you are free to call it anything you
wish.

<cTitle> is the title to use for the window.

Optional parameters <nX>, <nY>, <nWidth>, and <nHeight> allow
you to override the defaults and thus place the main window
wherever you desire.  <nX> and <nY> are the starting X and Y
coordinates.  <nWidth> and <nHeight> should be self-explanatory!

For example, to have this window occupy the full screen, you
could use:

     WinSetup(appname, app_description, 0, 0, 640, 480)

Optional parameter <cIcon> is the name of an icon made
available to the .EXE via a resource compiler.  This icon will
be used when the application is minimized (e.g. using Alt-Space N).

Optional parameter <cCursor> is either a pre-defined or user-
defined cursor to be used as the default mouse cursor for this
window class.  If you pass the name of a user-defined cursor,
that cursor must have been made available to the .EXE via a
resource compiler.

Optional parameter <nBrush> is one of the stock brushes found
in  WINDOWS.CH (e.g., WHITE_BRUSH, etcetera).  This will be
used as the background drawing brush for this window class.

<nStyle> is an optional numeric parameter specifying the
window style to use.  This should be a combination of the WS_*
values defined in WINDOWS.CH (such as WS_OVERLAPPEDWINDOW +
WS_CLIPCHILDREN).  The default is WS_OVERLAPPEDWINDOW.

Returns
A handle to the newly created window, or NIL if there was an
error.

Description
This function is provided for convenience.  It is generally
used for your main (or start-up) window.  It uses
RegisterClass() to register the new window class, and creates
a window of that particular class.

In addition to specifying the position of the window, you can
specify the icon, cursor, and background brush to be
associated with this window class.

The source is provided in SOURCE\WINSETUP.PRG.

Example
hWnd := WinSetup( "Clip-4-Win", "Clip-4-Win Notepad",           ;
                  0, 0, 600, 400, "editicon", "editcurs", WHITE_BRUSH )
if  hWnd <> NIL
   HideCaret( hWnd )
   // proceed with event loop, etc.
endif


See Also: CreateWindow() DestroyWindow() RegisterClass()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson