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>registerclass()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
RegisterClass()
Inform Windows of a new window class
------------------------------------------------------------------------------

Syntax
RegisterClass( <nStyle>, <hInst>, <hIcon>, <hCursor>, <hBgBrush>,
               <cClass>, [ <bAction> ] , [ <aWM> | -1 ] , [ <nType> ] ,
               [ <nClassExtra> ] , [ <nWndExtra> ] , [ <cMenu> | <nId> ] )
     -->   lSuccess

Arguments
<nStyle> is the class style to use for the new window class (a
combination of the CS_* values defined in WINDOWS.CH).

<hInst> is the handle of the instance of the application.  (As
returned by the _GetInstance() function.)

<hIcon> is a handle to the icon to use if a window of the
class is minimised.   (Use NIL or zero (0) for the default.)

<hCursor> is a handle to the cursor to use whenever the mouse
position is within the client area of a window of the new
class.  (Use NIL or zero (0) for the default.)

<hBgBrush> is a handle to the brush to be used for the
background of any windows of the new class.  You can use your
own brush handle, or one of the COLOR_* values defined in
WINDOWS.CH, in which case you have to add one (e.g.
COLOR_APPWORKSPACE + 1), or NIL or zero (0) for the default.

<cClass> is a character string giving the name of the new
class.

The following parameters are intended for advanced use only:

<bAction> is an optional code block to act as a window
procedure, i.e. to be given the messages specified by <aWM>.

<aWM> is an optional array of messages (or -1, meaning all
messages) to be sent to the code block <bAction> when they
occur.  <nType> decides where other messages are sent.

<nType> indicates the type of window class, and should be one
of the RCF_* values defined in WINDOWS.CH.  The default is
RCF_WINDOW.

<nClassExtra> is the number of class extra bytes.

<nWndExtra> is the number of window extra bytes.

<cMenu> | <nId> is the menu name or menu id to be used, if any.

Returns
If successful, logical TRUE (.T.) is returned, otherwise FALSE
(.F.) is returned.

Description
This function registers the new window class with Windows, so
that the class can be specified with the CreateWindow()
function.

Note: it does not appear to be necessary to call UnregisterClass()
unless you registered a global class (using CS_GLOBALCLASS), which
is fairly unlikely.

Example
hInst = _GetInstance()
if !RegisterClass( CS_SAVEBITS + CS_DBLCLKS, hInst, 0, 0, 0, "MyApp" )
     // failed
     quit
endif

For examples of the advanced forms of this function, see
source\odraw.prg, source\toolbar.prg and source\mdi*.prg.

See Also: CreateWindow() UnregisterClass()

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