WinSute Written by Sean Van Buggenum
Email: sean@sdf.lonestar.org


WinSute Helper Classes

WinSute Helper Classes are available to make the creation and management of all 'Windows' (including Controls and Dialogs) as easy as possible, as well as providing the structural support for easy development of readable and logical code.
The WinSute Helper Classes are as follows:

1. WinMaker_BASE
2. WinLayout
3. WinController
4. WinMaker


WinMaker_BASE

WinMaker_BASE Contains functionality, used in one way or another, that provides for registration of Simple Windows with the system registry. This allows the tracking of windows throughout an application.
Classes that inherit from WinMaker_BASE include SDialog and WinMaker. SWindow class gains use of these functionalities through it's member object WinMaker.

Member Functions:
    public:

    // public member functions

        WinMaker_BASE();
        ~WinMaker_BASE();

        unsigned int GetNumOpenWindows();

    protected:

    // protected member functions

        void update_registry(HWND _hWnd); // registers a new window
        void unregister_window(HWND _hWnd); // unregisters a closing window

    private:

    // private member functions

        void register_WinMaker();
        void unregister_WinMaker();
        long register_process(DWORD _PID);
        long unregister_process(DWORD _PID);

    // private data members

        HKEY hkeyWinMaker;
        HKEY hkeyPID;
        DWORD PID;

        static int key_init;// new member 10/11/02
                    // 1 is initial value that it starts off with,
                    // later if in constructor found at more than 1 that means
                    // that that isn't the first instance created
                    // value incremented during construction of every WinMaker

        int windows_created_by_this;

QuickInfo

Header: Declared in WinSute.h.
Import Library: Use WinSute.lib

See Also

WinMaker, SDialog,


WinMaker_BASE::GetNumOpenWindows

The WinMaker_BASE::GetNumOpenWindows function returns the number of windows opened, for the calling application, created through the WinMaker_BASE class, ie, all Classes inheriting from WinMaker_BASE.
unsigned int WinMaker_BASE::GetNumOpenWindows();

Parameters

This function requires no parameters

Return Values

This function returns the number of windows registered with the WinMaker key in the System Registry for the application that this function is called from.

Remarks

This function does not include any windows not created through WinMaker_BASE. ie, it will include windows derived from SWindow because SWindow creates it's windows using WinMaker, which in-turn inherits from WinMaker_BASE. Dialog Boxes created through SDialog will ALSO be included because SDialog class directly inherits from WinMaker_BASE.

QuickInfo

Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in WinSute.h.
Import Library: Use WinSute.lib & User32.lib

See Also

SWindow::GetNumOpenWindows


WinMaker_BASE::unregister_window

The WinMaker_BASE::unregister_window function looks for a reference to the specified window in the system registry, and if it finds it, deletes the reference, and decrements the window count.
Using this method allows us to keep track of the number of open windows in an application.
void WinMaker_BASE::unregister_window(HWND _hWnd);

Parameters

_hWnd

Handle to the window to be unregistered

QuickInfo

Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in WinSute.h.
Import Library: Use WinSute.lib & User32.lib

See Also

WinMaker::unregister


WinMaker_BASE::update_registry

The WinMaker_BASE::update_registry function creates an entry in the system registry for the specified window. It also increments the window count for the calling application.
Using this method allows us to keep track of the number of open windows in an application.
void WinMaker_BASE::update_registry(HWND _hWnd);

Parameters

_hWnd

Handle to the window to be registered

QuickInfo

Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in WinSute.h.
Import Library: Use WinSute.lib & User32.lib

See Also


WinLayout

WinLayout class is blue-print for using layout to manage child windows, like buttons,edit windows etc etc. The idea is that their is kept a HWND type. It is the parent_hwnd which is defined as the main parent window This is the only HWND type that WinLayout keeps. Any inheritor of WinLayout may keep others. parent_hwnd is kept mainly for the purpose of error reporting.

Member Functions:
    public:

    // public member functions

        WinLayout(HWND ahwnd);
        virtual ~WinLayout();

        void InitRegion()

        virtual int setup(...)=0; // pure virtual function must implement

        virtual int update()=0; // pure virtual function must implement

Member Variables:

    protected:

        HWND parent_hwnd;

Remarks

Example usage is provided through the following Layout files: Layout.h, and Layout.cpp

QuickInfo

Header: Declared in WinSute.h.
Import Library: Use WinSute.lib

See Also


WinLayout::setup

The WinLayout::setup pure virtual member function must be implemented to create an instance of any class with this class as it's base.

virtual int WinLayout::setup(
    HWND _my_hwnd,
    HINSTANCE _hInstance,
    void* sdata
)=0;

Parameters

my_hwnd

Handle to the window whose Layout is being setup.

_hInstance

Handle to the application Instance

sdata

any window Layout specific data

Return Values

Return values, as an integer for error checking, are up to the user.

Remarks

This function must be called in initialization of the Skin class for the function Skin::DrawSkin to have any effect.

QuickInfo

Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in WinSute.h.
Import Library: Use WinSute.lib & User32.lib

See Also


WinLayout::update

The WinLayout::update pure virtual member function must be implemented to create an instance of any class with this class as it's base.
virtual int WinLayout::update()=0;

Parameters

This function requires no parameters.

Return Values

Return values, as an integer for error checking, are up to the user.

Remarks

This function must be called in initialization of the Skin class for the function Skin::DrawSkin to have any effect.

QuickInfo

Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in WinSute.h.
Import Library: Use WinSute.lib & User32.lib

See Also


WinController

WinController class can be used for assistance in managing complex Windows programs. For instance, An instance of this class might be stored in the Window Specific data Storage provided by Windows (through SetWindowLong). This class acts as a base class, for those wishing to use it, but also may be used by itself (though it won't do much!). It allows all the freedom of design of the Controller's Sub-classes to the user/programmer

Member Functions:
    public:

    // public member functions

        WinController(HWND ahwnd,
        HINSTANCE hinst
        );

        virtual ~ WinController()

    protected:

    // protected virtual functions for overriding

Member Variables:

    public:

        HINSTANCE hInstance;

    protected:

        HWND hwnd;

Remarks

Example usage is provided through the following WinController files: Controller.h, and Controller.cpp

QuickInfo

Header: Declared in WinSute.h.
Import Library: Use WinSute.lib

See Also


WinMaker

WinMaker class is used to create and manage Windows, simplifying the development of a WIN CLASS (WNDCLASSEX), registration with windows, and the actual creation of the window.
It also provides the capability for Window related memory storage through two functions, get_param, and put_param. Additionally, WinMaker class inherits from class WinMaker_BASE which means that it automatically registers Windows created with this class with the system registry. in doing this it provides a means to keep track of opened windows, and closed windows through the close member function of WinMaker. By keeping track of windows in this manner, we are able (through the GetNumOpenWindows member function of WinMaker_BASE of which WinMaker inherits from, check the number of windows opened in an application. With this knowledge we can quit the application when necessary.

Member Functions:
    public:

    // public member functions

        WinMaker(
            HINSTANCE _hInstance, // handle to instance of window
            UINT cbsize,
                    LPCTSTR lpszClassName,
            WNDPROC _wp, // window process function
            HBRUSH _hb, // hbrBackground
            HCURSOR _hc, // hCursor
            HICON _hi, // hIcon
            HICON _his, // hIconSm
            LPCTSTR lpszMenuName,
            UINT style,
                    int cbClsExtra,
            int cbWndExtra
        );[1]

        WinMaker(WNDCLASSEX aclass);[2]

        virtual ~WinMaker();

        ATOM register_class();

        HWND create_window(...)
        int show(...)
        HWND get_running_window()
        void* get_param(...)
        void put_param(...)
        void close(...)
        void unregister(HWND _hWnd);
            // unregisters a given window if it exists in registry

Member Variables:

    protected:

        sute::SLinkedList<HWND, void*>* list;
        WNDCLASSEX wclassex;

QuickInfo

Header: Declared in WinSute.h.
Import Library: Use WinSute.lib

See Also

WinMaker_BASE


WinMaker::close

The WinMaker::close function cleans up memory used for storage for a Window created through the WinMaker class, or any other subclass of WinMaker_BASE, Destroys the window (through the call DestroyWindow, and unregisters the specified window with the system registry.

The Application Window Count is updated via this method.
void WinMaker::close(
    HWND _hWnd
)

Parameters

_hWnd

Handle to the Window.

Return Values

This function returns no values.

Remarks

This function does not automatically quit the application for the user. This must be achieved via the PostQuitMessage function. It does however update the registry and provide an up-to-date count of the number of windows still open for that application. This information may be retrieved via the GetNumOpenWindows function available through any class inheriting the WinMaker_BASE class. WinMaker and SDialog both inherit this function directly.

This function will not affect the registry if called with a HWND that was not originally registered through WinMaker or any other subclass of WinMaker_BASE.

This function will ALWAYS destroy a valid window.

QuickInfo

Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in WinSute.h.
Import Library: Use WinSute.lib & User32.lib

See Also


WinMaker::create_window

The WinMaker::create_window member function creates a non-modal Dialog Box.
HWND create_window(
    char* window_title,
    DWORD style,
    HMENU menu,
    void* mdic_lparam,
    int x = CW_USEDEFAULT,
    int y = CW_USEDEFAULT,
    int nWidth = CW_USEDEFAULT,
    int nHeight = CW_USEDEFAULT
    DWORD dwExStyle=NULL,
    HWND _Parent==NULL
);

Parameters

window_title

A String of characters containing text to place in the Window Title-bar

dwStyle

Specifies the style of the window being created. This parameter can be a combination of the following window styles, plus the control styles indicated in the Remarks section.

Style | Meaning
WS_BORDER | Creates a window that has a thin-line border.
WS_CAPTION | Creates a window that has a title bar (includes the WS_BORDER style).
WS_CHILD | Creates a child window. This style cannot be used with the WS_POPUP style.
WS_CHILDWINDOW | Same as the WS_CHILD style.
WS_CLIPCHILDREN | Excludes the area occupied by child windows when drawing occurs within the parent window. This style is used when creating the parent window.
WS_CLIPSIBLINGS | Clips child windows relative to each other; that is, when a particular child window receives a WM_PAINT message, the WS_CLIPSIBLINGS style clips all other overlapping child windows out of the region of the child window to be updated. If WS_CLIPSIBLINGS is not specified and child windows overlap, it is possible, when drawing within the client area of a child window, to draw within the client area of a neighboring child window.
WS_DISABLED | Creates a window that is initially disabled. A disabled window cannot receive input from the user.
WS_DLGFRAME | Creates a window that has a border of a style typically used with dialog boxes. A window with this style cannot have a title bar.
WS_GROUP | Specifies the first control of a group of controls. The group consists of this first control and all controls defined after it, up to the next control with the WS_GROUP style. The first control in each group usually has the WS_TABSTOP style so that the user can move from group to group. The user can subsequently change the keyboard focus from one control in the group to the next control in the group by using the direction keys.
WS_HSCROLL | Creates a window that has a horizontal scroll bar.
WS_ICONIC | Creates a window that is initially minimized. Same as the WS_MINIMIZE style.
WS_MAXIMIZE | Creates a window that is initially maximized.
WS_MAXIMIZEBOX | Creates a window that has a Maximize button. Cannot be combined with the WS_EX_CONTEXTHELP style. The WS_SYSMENU style must also be specified.
WS_MINIMIZE | Creates a window that is initially minimized. Same as the WS_ICONIC style.
WS_MINIMIZEBOX | Creates a window that has a Minimize button. Cannot be combined with the WS_EX_CONTEXTHELP style. The WS_SYSMENU style must also be specified.
WS_OVERLAPPED | Creates an overlapped window. An overlapped window has a title bar and a border. Same as the WS_TILED style.
WS_OVERLAPPEDWINDOW | Creates an overlapped window with the WS_OVERLAPPED, WS_CAPTION, WS_SYSMENU, WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX styles. Same as the WS_TILEDWINDOW style.
WS_POPUP | Creates a pop-up window. This style cannot be used with the WS_CHILD style.
WS_POPUPWINDOW | Creates a pop-up window with WS_BORDER, WS_POPUP, and WS_SYSMENU styles. The WS_CAPTION and WS_POPUPWINDOW styles must be combined to make the window menu visible.
WS_SIZEBOX | Creates a window that has a sizing border. Same as the WS_THICKFRAME style.
WS_SYSMENU | Creates a window that has a window-menu on its title bar. The WS_CAPTION style must also be specified.
WS_TABSTOP | Specifies a control that can receive the keyboard focus when the user presses the tab key. Pressing the tab key changes the keyboard focus to the next control with the WS_TABSTOP style.
WS_THICKFRAME | Creates a window that has a sizing border. Same as the WS_SIZEBOX style.
WS_TILED | Creates an overlapped window. An overlapped window has a title bar and a border. Same as the WS_OVERLAPPED style.
WS_TILEDWINDOW | Creates an overlapped window with the WS_OVERLAPPED, WS_CAPTION, WS_SYSMENU, WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX styles. Same as the WS_OVERLAPPEDWINDOW style.
WS_VISIBLE | Creates a window that is initially visible.
WS_VSCROLL | Creates a window that has a vertical scroll bar.

hMenu
Handle to a menu, or specifies a child-window identifier depending on the window style. For an overlapped or pop-up window, hMenu identifies the menu to be used with the window; it can be NULL if the class menu is to be used. For a child window, hMenu specifies the child-window identifier, an integer value used by a dialog box control to notify its parent about events. The application determines the child-window identifier; it must be unique for all child windows with the same parent window.

x
Specifies the initial horizontal position of the window. For an overlapped or pop-up window, the x parameter is the initial x-coordinate of the window's upper-left corner, in screen coordinates. For a child window, x is the x-coordinate of the upper-left corner of the window relative to the upper-left corner of the parent window's client area.
If this parameter is set to CW_USEDEFAULT, the system selects the default position for the window's upper-left corner and ignores the y parameter. CW_USEDEFAULT is valid only for overlapped windows; if it is specified for a pop-up or child window, the x and y parameters are set to zero.

y
Specifies the initial vertical position of the window. For an overlapped or pop-up window, the y parameter is the initial y-coordinate of the window's upper-left corner, in screen coordinates. For a child window, y is the initial y-coordinate of the upper-left corner of the child window relative to the upper-left corner of the parent window's client area. For a list box, y is the initial y-coordinate of the upper-left corner of the list box's client area relative to the upper-left corner of the parent window's client area.
If an overlapped window is created with the WS_VISIBLE style bit set and the x parameter is set to CW_USEDEFAULT, the system ignores the y parameter.

mdic_lparam
A pointer to an instance of LPARAMS is passed to the created window's WM_CREATE Message. mdic_lparam is stored as the ' user_param' member of this LPARAMS. A pointer to this WinMaker is stored in the 'hwinmaker' parameter of LPARAMS.

nWidth
Specifies the width, in device units, of the window. For overlapped windows, nWidth is either the window's width, in screen coordinates, or CW_USEDEFAULT. If nWidth is CW_USEDEFAULT, the system selects a default width and height for the window; the default width extends from the initial x-coordinate to the right edge of the screen, and the default height extends from the initial y-coordinate to the top of the icon area. CW_USEDEFAULT is valid only for overlapped windows; if CW_USEDEFAULT is specified for a pop-up or child window, nWidth and nHeight are set to zero.

nHeight
Specifies the height, in device units, of the window. For overlapped windows, nHeight is the window's height, in screen coordinates. If nWidth is set to CW_USEDEFAULT, the system ignores nHeight.

Return Values

This function returns a Handle to the newly created Window.

QuickInfo

Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in WinSute.h.
Import Library: Use WinSute.lib & User32.lib

See Also


WinMaker::get_param

The WinMaker::get_running_window member function returns a pointer to user created memory related to a specified HWND, and of this Window-Class.
void* WinMaker::get_param(HWND _hWnd);

Parameters

_hWnd

Handle to the Window to which the memory is related.

Return Values

This function returns a pointer to user created memory related to a specified HWND, and of this Window-Class.

QuickInfo

Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in WinSute.h.
Import Library: Use WinSute.lib & User32.lib

See Also

WinMaker::put_param


WinMaker::get_running_window

The WinMaker::get_running_window member function returns a handle to a currently running window of the same Window-class.
HWND WinMaker::get_running_window()

Parameters

This function requires no parameters.

Return Values

This function returns a handle to a currently running window of this Window-class,
or NULL if it doesn't exist.

QuickInfo

Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in WinSute.h.
Import Library: Use WinSute.lib & User32.lib

See Also


WinMaker::put_param

The WinMaker::put_running_window member function stores user created memory related to a specified HWND, and of this Window-Class.
void WinMaker::get_param(
    HWND _hWnd,
    void* param
);

Parameters

_hWnd

Handle to the Window to which the memory is related.

Param

Pointer to memory to store, related to the specified HWND, and of this Window-Class.

Return Values

This function returns no values.

QuickInfo

Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in WinSute.h.
Import Library: Use WinSute.lib & User32.lib

See Also

WinMaker::get_param


WinMaker::Show

The WinMaker::Show member function affects the Show state of a window.
BOOL WinMaker::show(
    HWND _hwnd,
    int smode
);

Parameters

_hwnd

Handle to the Window to Show.

cmd_show

Mode of ShowWindow. Values may be SW_SHOW, SW_HIDE, or any other found in the MSDN's ShowWindow entry.

Return Values

If the window was previously visible, the return value is nonzero.
If the window was previously hidden, the return value is zero.

Remarks

This function also calls the Win32 function ::UpdateWindow(HWND).

QuickInfo

Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in WinSute.h.
Import Library: Use WinSute.lib & User32.lib

See Also


WinMaker::unregister

The WinMaker::unregister function looks for a reference to the specified window in the system registry, and if it finds it, deletes the reference, and decrements the window count.
This function is simply a public interface to WinMaker's protected member function unregister_window which it inherits from WinMaker_BASE.
Using this method allows us to keep track of the number of open windows in an application.
void WinMaker::unregister(HWND _hWnd);

Parameters

_hWnd

Handle to the window to be unregistered

QuickInfo

Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in WinSute.h.
Import Library: Use WinSute.lib & User32.lib

See Also

WinMaker_BASE::unregister_window


Exceptions

The WinSute Exception Classes are to be used in the future to provide a reliable, consistent method of error detection where critical operations are used. Currently there is only one Exception class. This class will be the base class for all further Exception classes, and also may be inherited by user defined Exceptions.

SException


SException

SException is the base class for all exceptions in the WinSute class Library. It itself inherits from std::exception class which allows the user to catch such an exception within the general std::exception context. It is intended, as programmers, that you will either use this exception class to throw errors, or create specialized exception classes by deriving this class as base. These exceptions are intended to be used with the standard c++ style throw/catch statements.

Member Functions:
    SException(const char* amessage);
    SException(const SException &other);
    ~SException() throw();
    SException& operator=(const SException &other);
    const char* what();

QuickInfo

Header: Declared in WinSute.h.
Import Library: Use WinSute.lib

See Also


Global Data Structures

The Following Data Structures are used within the WinSute Helper Classes, and the WinSute Windows Classes.

LPARAMS


FileDialogProcedure

The FileDialogProcedure is an application-defined or library-defined function used with the OpenDialogBox, and SaveDialogBox functions. This function is called after a successful return from either GetSaveFileName, or GetOpenFileName functions which are called internally.

The FileDialogProc type defines a pointer to this function. FileDialogProcedurec is a placeholder for the application-defined or library-defined function name.

int FileDialogProcedure(
    OPENFILENAME& ofn,
    void* param
);

Parameters

ofn

OPENFILENAME type filled and recieved from either OpenDialogBox, and SaveDialogBox functions.

param

User defined value passed into either OpenDialogBox, and SaveDialogBox functions as the 2nd argument, named also param.

QuickInfo

Header: Declared in WinSute.h.
Import Library: Use WinSute.lib

See Also

SWin_BASE::OpenDialogBox, SWin_BASE::SaveDialogBox


LPARAMS

struct LPARAMS{
    WinMaker* hwinmaker;
    void* user_param;
};

QuickInfo

Header: Declared in WinSute.h.
Import Library: Use WinSute.lib

See Also

WinMaker::create_window


Global Functions

The Following Functions are available on the WinSute Global Address space.

DialogBox related functions

IsForDialog


ResourceGFunctions

Resource Related, Global Functions

The Following functions are available on the WinSute Global Address Space, and are related to the use of Window Resources such as Icons, Bitmaps etc.

MAKE_HICON


MAKE_HICON

The MAKE_HICON function is to be used to create handle to an icon from a resource ID. This function might be used to provide a HICON for a WNDCLASSEX, or in constructors for either WinMaker, or SWindow.
HICON MAKE_HICON(
    HINSTANCE _hInstance,
    WORD wInteger
);

Parameters

_hInstance

Handle to a application

wInteger

Integer ID for Icon Resource

Return Values

If the call is successful, the return will be non-NULL and will be a handle to an Icon. If the call is Unsuccessful, the return will equal NULL.

Remarks

The MAKE_HICON function is simple combines the two functions; MAKEINTRESOURCE, and LoadIcon into one convenient function.

QuickInfo

Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in WinSute.h.
Import Library: Use WinSute.lib & User32.lib

See Also

WinMaker, SWindow


DialogBoxGFunctions

Dialog Box Related, Global Functions

The Following functions are available on the WinSute Global Address Space, and are related to the operation and/or use of Dialog Boxes.

IsForDialog


IsForDialog

The IsForDialog function is to be used instead of the WIN32 native function, IsDialogMessage.
BOOL IsForDialog(
  HWND hWnd,   // Handle to a Window
  LPMSG pmsg   // Pointer to MSG Struct Containing
           // information about the latest message
);

Parameters

hWnd
Handle to a Window, Control or Dialog etc...
pmsg
Pointer to a MSG Struct containing information about the latest message that this query concerns.

Return Values

If the concerning message is for a DialogBox, then the message is passed along to the appropriate Dialog Message Handler, and IsForDialog returns TRUE. If the concerning message is NOT for a DialogBox, then the message is not dispatched further, and IsForDialog returns FALSE.

Remarks

The IsForDialog function is to be used instead of the WIN32 native function, IsDialogMessage. IsDialogMessage is too indescriminate in it's capturing of messages which are not necessarily dialog boxes but things like EDIT boxes and other controls. This function is used exactly the same as as IsDialogMessage but requires the programmer not to name any user defined windows starting with a '#' that is the only restriction in using this work-around. Example Usage:
MSG msg;
HACCEL hAccel =0;
// other code
//  other code

while(GetMessage(&msg, NULL, 0 , 0)){

    if (!IsForDialog(msg.hwnd, &msg)){

        hwnd = GetParent(msg.hwnd);
        // need to do the following line to divert messages
        if (hwnd==0) hwnd = msg.hwnd;
        if (!TranslateAccelerator(hwnd, hAccel,&msg)){

            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
    }
}

QuickInfo

Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in WinSute.h.
Import Library: Use WinSute.lib & User32.lib

See Also


WindowsClassPlugins

Window Class Plugins

The following classes are designed to provide easy development of specific features or functionality that can be 'plugged in' to new or existing Window classes through the method of Multiple Inheritance. Examples are provided within the specific class descriptions.
The Following Class Plugins are currently available.

1. Skin
2. SRegion


SRegion

SRegion class is the base class to use when you desire to attach a Region to a window or control (usually in order to control painting of that window, or it's appearance in some other way). This class is often used with the WinSute Skin class to finish off the 'Skinned' look to a window or Control.

Member Functions:

    public:

    // public member functions

        SRegion(int REGION_DATA_RESOURCE_CODE,
             LPCTSTR RESOURCE_TYPE
        );

        virtual ~SRegion()=0
        void InitRegion()
        void repaint(…)

Member Variables:

    private:

        HRGN srgn; // deleted on init
        char* RESOURCE_TYPE;
            // temporarily used between constructor and InitRegion

        int R_RESOURCE_CODE;
            // temporarily used between constructor and InitRegion

QuickInfo

Header: Declared in WinSute.h.
Import Library: Use WinSute.lib

See Also


SRegion::InitRegion

The SRegion::InitRegion member function assigns the Region, specified in the SRegion Constructor, to the specified Window.
void InitRegion();

Parameters

This function requires no parameters.

Return Values

This function has no return value

QuickInfo

Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in WinSute.h.
Import Library: Use WinSute.lib & User32.lib

See Also


SRegion::repaint

The SRegion::repaint member function selects the specified region, and forces a repaint of that region.
void repaint(BOOL Erase=FALSE)

Parameters

Erase

This parameter specifies whether the region should first be erased before the repaint. The default value for this is FALSE which specifies that the region NOT be erased first.

Return Values

This function has no return value;

QuickInfo

Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in WinSute.h.
Import Library: Use WinSute.lib & User32.lib

See Also

SWin_BASE::repaint


Skin

Skin class is the base class to use when you desire to 'Skin' your window or control with a simple bitmap image, in either a tile or stretch manner.

To Use the Skin class, create a Window class (eg a SWindow, SDialog, or SControl), and also Inherit class Skin. Give the Skin class constructor the Image resource code located in the resource.h file usually, and set the Skin Type to either FULL_SKIN, or TILE_SKIN; as defined in WinSute.h:

#define FULL_SKIN 0
#define TILE_SKIN 1
If the Skin Type is set to FULL_SKIN, the imagex and imagey dimensions will be ignored and the image will be set to the dimensions of the window.
If the Skin Type is set to TILE_SKIN, the imagex, and imagey dimensions will specify the size that the bitmap image should appear on the screen. For example, Specifying smaller dimensions will see the image tiled more times across the window; Specifying larger dimensions will see the image tiled LESS number of times across the window.

Member Functions:

    public:

    // public member functions

        Skin(int IMAGE_RESOURCE_CODE,
            int _SkinType = FULL_SKIN,
            int imageX=0,
            int imageY=0
         );

        virtual ~Skin()=0;

        int LoadSkin()

    protected:

    // protected member functions

        void DrawSkin(...)

Member Variables:

    protected:

        HDC dcSkin; // skin device context
            HBITMAP hSkinBmp, hOldBmp; // skin bitmap and old device context bitmap
            int image; // resource code
            int SkinType;
            BITMAP _bitmap; // bitmap structure to be associated with actual image
            char isInitialized; // test and store if Skin has been loaded, only draw if true
            RECT WindowRect;

QuickInfo

Header: Declared in WinSute.h.
Import Library: Use WinSute.lib

See Also


Skin::DrawSkin

The Skin::DrawSkin member function paints the selected Bitmap onto the window.

void Skin::DrawSkin(    HDC hdc,
    HBITMAP _hSkinBitmap=NULL
);

Parameters

Hdc
Handle to a Device Context for Painting

_hSkinBitmap

Handle to BITMAP

Return Values

This function has no return value

Remarks

If hSkinBitmap is specified and NOT NULL, the DrawSkin function uses the specified BITMAP to paint the region. Otherwise it will use the BITMAP specified in the Constructor of the Skin class.

QuickInfo

Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in WinSute.h.
Import Library: Use WinSute.lib & User32.lib

See Also


Skin::LoadSkin

The Skin::LoadSkin member function loads the bitmap to be used for the skin.
BOOL Skin::LoadSkin();

Parameters

This function requires no parameters.

Return Values

If the Skin was previously loaded, OR Loading the Skin was successful, this function returns zero. If this function is unsuccessful, the return value is negative.

Remarks

This function must be called in initialization of the Skin class for the function Skin::DrawSkin to have any effect.

QuickInfo

Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in WinSute.h.
Import Library: Use WinSute.lib & User32.lib

See Also


Window Classes

The following Window classes are designed to provide easy development of all Windows types, including DialogBoxe's and Controls.
The Following Window Classes are currently available:

1. SWin_BASE
2. SControl
3. SDialog
4. SWindow


SWin_BASE

SWin_BASE is the base class for all 'Simple' Windows found in the Simple Foundation Class. It contains the basic functionality that ALL Simple Windows should have, such as appropriately overloaded MessageBox functions, repaint, and commonly used message handlers.

Member Functions:
    public:

    // public member functions

        SWin_BASE();
        ~SWin_BASE();

        int MessageBox(...);
        void repaint(...);
        void MoveWindow(...);
        HWND getHWND();
        HINSTANCE getHINSTANCE();
        BOOL PostMessage(...);
        LRESULT SendMessage(...);
        static int SaveDialogBox(...)
        static int OpenDialogBox(...)

    protected:

    // protected member functions to be overridden
    // by derived window classes (eg. SDialog).

        virtual inline void OnShowWindow(...);
        virtual inline void OnSize(...);
        virtual inline void OnSizing(...);
        virtual inline void OnPaint();
        virtual inline void OnNCDestroy();

Member Variables:

    protected:

        HINSTANCE hInstance;
        HWND hWnd;
        long SWin_Width;
        long SWin_Height;

QuickInfo

Header: Declared in WinSute.h.
Import Library: Use WinSute.lib

See Also

SWindow, SDialog


SWin_BASE::getHINSTANCE

The SWin_BASE::getHINSTANCE member function returns the HINSTANCE (Handle to an application) that the class instance is attached to.
inline HINSTANCE getHINSTANCE();

Parameters

This function requires no parameters.

Return Values

This function returns the HINSTANCE that the class instance is attached to.

QuickInfo

Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in WinSute.h.
Import Library: Use WinSute.lib & User32.lib

See Also


SWin_BASE::getHWND

The SWin_BASE::getHWND member function returns the HWND (Handle to a Window) that the class instance is attached to.
inline HWND getHWND();

Parameters

This function requires no parameters.

Return Values

This function returns the HWND that the class instance is attached to.

QuickInfo

Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in WinSute.h.
Import Library: Use WinSute.lib & User32.lib

See Also


SWin_BASE::MessageBox

The SWin_BASE::MessageBox member functions show a small modal window in which short messages may be shown.
inline int MessageBox(
    LPCTSTR lpText,
    LPCTSTR lpCaption=NULL,
    UINT uType=MB_OK
);[1]

inline int MessageBox(
    HWND _hWnd,
    LPCTSTR lpText,
    LPCTSTR lpCaption=NULL,
    UINT uType=MB_OK
);[2]

inline int MessageBox(
    int code,
    LPCTSTR lpCaption=NULL,
    UINT uType=MB_OK
);[3]

Parameters

Several variations on this function are available for use (for the users convenience). MessageBox[3] provides an integer parameter for easy output of numerical values.
hWnd
Identifies the owner window of the message box to be created. If this parameter is NULL, the message box has no owner window.
lpText
Pointer to a null-terminated string containing the message to be displayed.
lpCaption
Pointer to a null-terminated string used for the dialog box title. If this parameter is NULL, the default title Error is used.
code
Numerical value to be displayed (only in MessageBox[3])
uType
Specifies a set of bit flags that determine the contents and behavior of the dialog box. This parameter can be a combination of flags from the following groups of flags.
Specify one of the following flags to indicate the buttons contained in the message box:
Flag | Meaning
MB_ABORTRETRYIGNORE | The message box contains three push buttons: Abort, Retry, and Ignore.
MB_OK | The message box contains one push button: OK. This is the default.
MB_OKCANCEL | The message box contains two push buttons: OK and Cancel.
MB_RETRYCANCEL | The message box contains two push buttons: Retry and Cancel.
MB_YESNO | The message box contains two push buttons: Yes and No.
MB_YESNOCANCEL | The message box contains three push buttons: Yes, No, and Cancel.
Specify one of the following flags to display an icon in the message box:
Flag | Meaning
MB_ICONEXCLAMATION, MB_ICONWARNING | An exclamation-point icon appears in the message box.
MB_ICONINFORMATION, MB_ICONASTERISK | An icon consisting of a lowercase letter i in a circle appears in the message box.
MB_ICONQUESTION | A question-mark icon appears in the message box.
MB_ICONSTOP, MB_ICONERROR, MB_ICONHAND | A stop-sign icon appears in the message box.
Specify one of the following flags to indicate the default button:
Flag | Meaning
MB_DEFBUTTON1 | The first button is the default button. MB_DEFBUTTON1 is the default unless MB_DEFBUTTON2, MB_DEFBUTTON3, or MB_DEFBUTTON4 is specified.
MB_DEFBUTTON2 | The second button is the default button.
MB_DEFBUTTON3 | The third button is the default button.
MB_DEFBUTTON4 | The fourth button is the default button.
Specify one of the following flags to indicate the modality of the dialog box:
Flag | Meaning
MB_APPLMODAL | The user must respond to the message box before continuing work in the window identified by the hWnd parameter. However, the user can move to the windows of other threads and work in those windows. Depending on the hierarchy of windows in the application, the user may be able to move to other windows within the thread. All child windows of the parent of the message box are automatically disabled, but popup windows are not. MB_APPLMODAL is the default if neither MB_SYSTEMMODAL nor MB_TASKMODAL is specified.
MB_SYSTEMMODAL | Same as MB_APPLMODAL except that the message box has the WS_EX_TOPMOST style. Use system-modal message boxes to notify the user of serious, potentially damaging errors that require immediate attention (for example, running out of memory). This flag has no effect on the user's ability to interact with windows other than those associated with hWnd.
MB_TASKMODAL | Same as MB_APPLMODAL except that all the top-level windows belonging to the current thread are disabled if the hWnd parameter is NULL. Use this flag when the calling application or library does not have a window handle available but still needs to prevent input to other windows in the calling thread without suspending other threads.
In addition, you can specify the following flags:
MB_DEFAULT_DESKTOP_ONLY
The desktop currently receiving input must be a default desktop; otherwise, the function fails. A default desktop is one an application runs on after the user has logged on.
MB_HELP
Adds a Help button to the message box. Choosing the Help button or pressing F1 generates a Help event.
MB_RIGHT
The text is right-justified.
MB_RTLREADING
Displays message and caption text using right-to-left reading order on Hebrew and Arabic systems.
MB_SETFOREGROUND
The message box becomes the foreground window. Internally, the system calls the SetForegroundWindow function for the message box.
MB_TOPMOST
The message box is created with the WS_EX_TOPMOST window style.
MB_SERVICE_NOTIFICATION
Windows NT: The caller is a service notifying the user of an event. The function displays a message box on the current active desktop, even if there is no user logged on to the computer.
If this flag is set, the hWnd parameter must be NULL. This is so the message box can appear on a desktop other than the desktop corresponding to the hWnd.
For Windows NT version 4.0, the value of MB_SERVICE_NOTIFICATION has changed. See WINUSER.H for the old and new values. Windows NT 4.0 provides backward compatibility for pre-existing services by mapping the old value to the new value in the implementation of MessageBox and MessageBoxEx. This mapping is only done for executables that have a version number, as set by the linker, less than 4.0.
To build a service that uses MB_SERVICE_NOTIFICATION, and can run on both Windows NT 3.x and Windows NT 4.0, you have two choices.
    1. At link-time, specify a version number less than 4.0; or
2. At link-time, specify version 4.0. At run-time, use the GetVersionEx function to check the system version. Then when running on Windows NT 3.x, use MB_SERVICE_NOTIFICATION_NT3X; and on Windows NT 4.0, use MB_SERVICE_NOTIFICATION.
MB_SERVICE_NOTIFICATION_NT3X
Windows NT: This value corresponds to the value defined for MB_SERVICE_NOTIFICATION for Windows NT version 3.51.
Return Values
The return value is zero if there is not enough memory to create the message box. If the function succeeds, the return value is one of the following menu-item values returned by the dialog box:
Value | Meaning
IDABORT | Abort button was selected.
IDCANCEL | Cancel button was selected.
IDIGNORE | Ignore button was selected.
IDNO | No button was selected.
IDOK | OK button was selected.
IDRETRY | Retry button was selected.
IDYES | Yes button was selected.
If a message box has a Cancel button, the function returns the IDCANCEL value if either the esc key is pressed or the Cancel button is selected. If the message box has no Cancel button, pressing esc has no effect.

QuickInfo

Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in WinSute.h.
Import Library: Use WinSute.lib & User32.lib

See Also


SWin_BASE::MoveWindow

The SWin_BASE::MoveWindow member function moves the current window so that the top left corner of the frame appear at the specified co-ordinates.
inline void MoveWindow(
    int x,
    int y
);

Parameters

x

the x component of the Cartesian Co-ordinates.
y
the y component of the Cartesian Co-ordinates.
Return Values
This function has no return value;

QuickInfo

Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in WinSute.h.
Import Library: Use WinSute.lib & User32.lib

See Also


SWin_BASE::OnMessage

SWin_BASE::On"MessageName"

The SWin_BASE::On"MessageName" member functions provide a method for handling specific Window Messages as they are sent to it's specific Window. These functions are Virtual and by default do nothing. They are also, often, 'inline' functions to cut down in code and processing time when they are not used.
virtual void OnShowWindow(
    BOOL fShow,
    int fnStatus
);

virtual void OnSize(
    WPARAM wParam,
    LPARAM lParam
);

virtual void OnSizing(
    WPARAM wParam,
    LPARAM lParam
);

virtual void OnPaint();

virtual inline void OnNCDestroy();

Parameters

fShow

Value of wParam. Specifies whether a window is being shown. It is TRUE if the window is being shown or FALSE if the window is being hidden.

fnStatus

Value of lParam. Specifies the status of the window being shown. The fnStatus parameter is zero if the message is sent because of a call to the ShowWindow function; otherwise, fnStatus is one of the following values:

Value | Meaning
SW_OTHERUNZOOM | The window is being uncovered because a maximize window was restored or minimized.
SW_OTHERZOOM | The window is being covered by another window that has been maximized.
SW_PARENTCLOSING | The window's owner window is being minimized.
SW_PARENTOPENING | The window's owner window is being restored.

Remarks

The SWin_BASE::On"MessageName" member functions provide a method for handling specific Window Messages as they are sent to it's specific Window. These functions are Virtual and by default do nothing. They are also, often, 'inline' functions to cut down in code and processing time when they are not used.

QuickInfo

Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in WinSute.h.
Import Library: Use WinSute.lib & User32.lib

See Also


static SWin_BASE::OpenDialogBoxSendMessage

static SWin_BASE::OpenDialogBox

The static SWin_BASE::OpenDialogBox member function creates an Open-File common DialogBox.
static int  OpenDialogBox(
    FileDialogProc FileDialogProcedure,
    void* param,
    LPTSTR _lpstrFile,
    DWORD _nMaxFile,
    LPCTSTR _lpstrFilter=NULL,
    DWORD _nFilterIndex=0,
    LPCTSTR _lpstrInitialDir=NULL,
    LPCTSTR _lpstrTitle=NULL,
    HWND _Owner=NULL,
    HINSTANCE _hInstance=NULL,
    DWORD _Flags=OFN_PATHMUSTEXIST
);

Parameters

FileDialogProcedure

Function pointer that gets called on Dialog button OK from which further operations may be done using the completed OPENFILENAME.

param

2nd argument to be sent to the FileDialog Procedure.

_lpstrFile

Pointer to a buffer that contains a filename used to initialize the File Name edit control. The first character of this buffer must be NULL if initialization is not necessary. When the GetOpenFileName or GetSaveFileName function returns successfully, this buffer contains the drive designator, path, filename, and extension of the selected file.

If the OFN_ALLOWMULTISELECT flag is set and the user selects multiple files, the buffer contains the current directory followed by the filenames of the selected files. For Explorer-style dialog boxes, the directory and filename strings are NULL separated, with an extra NULL character after the last filename. For old-style dialog boxes, the strings are space separated and the function uses short filenames for filenames with spaces. You can use theFindFirstFile function to convert between long and short filenames.

If the buffer is too small, the function returns FALSE and the CommDlgExtendedError function returns FNERR_BUFFERTOOSMALL. In this case, the first two bytes of the lpstrFile buffer contain the required size, in bytes or characters.

_nMaxFile

Specifies the size, in bytes (ANSI version) or 16-bit characters (Unicode version), of the buffer pointed to by lpstrFile. The GetOpenFileName and GetSaveFileName functions return FALSE if the buffer is too small to contain the file information. The buffer should be at least 256 characters long.

_lpstrFilter

Pointer to a buffer containing pairs of null-terminated filter strings. The last string in the buffer must be terminated by two NULL characters.

The first string in each pair is a display string that describes the filter (for example, "Text Files"), and the second string specifies the filter pattern (for example, "*.TXT").

To specify multiple filter patterns for a single display string, use a semicolon to separate the patterns (for example, "*.TXT;*.DOC;*.BAK"). A pattern string can be a combination of valid filename characters and the asterisk (*) wildcard character. Do not include spaces in the pattern string.

The system does not change the order of the filters. It displays them in the File Types combo box in the order specified in lpstrFilter. If lpstrFilter is NULL, the dialog box does not display any filters.

_nFilterIndex

Specifies the index of the currently selected filter in the File Types control. The buffer pointed to by lpstrFilter contains pairs of strings that define the filters. The first pair of strings has an index value of 1, the second pair 2, and so on. An index of zero indicates the custom filter specified by lpstrCustomFilter. You can specify an index on input to indicate the initial filter description and filter pattern for the dialog box. When the user selects a file, nFilterIndex returns the index of the currently displayed filter.

If nFilterIndex is zero and lpstrCustomFilter is NULL, the system uses the first filter in the lpstrFilter buffer. If all three members are zero or NULL, the system does not use any filters and does not show any files in the file list control of the dialog box.

_lpstrInitialDir

Pointer to a string that specifies the initial file directory.

Windows NT 5.0 and later; Windows 98 and later:

If lpstrInitalDir is NULL and the current directory contains any files of the specified filter types, the initial directory is the current directory.

If lpstrInitalDir is NULL and the current directory does not contain any files of the specified filter types, the initial directory is the personal files directory of the current user. To specify the current user's personal files directory as the initial directory, set lpstrInitialDir to the path returned by calling theSHGetSpecialFolderLocation function with the CSIDL_PERSONAL flag.

Earlier versions of Windows and Windows NT:

If lpstrInitalDir is NULL, the initial directory is the current directory.

_lpstrTitle

Pointer to a string to be placed in the title bar of the dialog box. If this member is NULL, the system uses the default title (that is, Save As or Open).

_Owner

Identifies the window that owns the dialog box. This member can be any valid window handle, or it can be NULL if the dialog box has no owner.

_hInstance

If the OFN_ENABLETEMPLATEHANDLE flag is set in the Flags member, hInstance is the handle of a memory object containing a dialog box template. If the OFN_ENABLETEMPLATE flag is set, hInstance identifies a module that contains a dialog box template named by the lpTemplateName member. If neither flag is set, this member is ignored.

If the OFN_EXPLORER flag is set, the system uses the specified template to create a dialog box that is a child of the default Explorer-style dialog box. If the OFN_EXPLORER flag is not set, the system uses the template to create an old-style dialog box that replaces the default dialog box.

_Flags

A set of bit flags you can use to initialize the dialog box. When the dialog box returns, it sets these flags to indicate the user's input. This member can be a combination of the following flags:

OFN_ALLOWMULTISELECT
OFN_CREATEPROMPT
OFN_ENABLEHOOK
OFN_ENABLESIZING
OFN_ENABLETEMPLATE
OFN_ENABLETEMPLATEHANDLE
OFN_EXPLORER
OFN_EXTENSIONDIFFERENT
OFN_FILEMUSTEXIST
OFN_HIDEREADONLY
OFN_LONGNAMES
OFN_NOCHANGEDIR
OFN_NODEREFERENCELINKS
OFN_NOLONGNAMES
OFN_NONETWORKBUTTON
OFN_NOREADONLYRETURN
OFN_NOTESTFILECREATE
OFN_NOVALIDATE
OFN_OVERWRITEPROMPT
OFN_PATHMUSTEXIST
OFN_READONLY
OFN_SHAREAWARE
OFN_SHOWHELP
Note: For meanings, please see the Microsoft MSDN.

Return Values

If the Cancel button of the DialogBox is used to close the OpenDialogBox, the function will go no further, and will return zero.
If the Cancel button is Not used, the return will be the return of the FileDialogProcedure.

QuickInfo

Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in WinSute.h.
Import Library: Use WinSute.lib & User32.lib

See Also

SWin_BASE::SaveDialogBox


SWin_BASE::PostMessage

The SWin_BASE::PostMessage member function Posts a message to the caller window.
inline BOOL PostMessage(
    UINT Msg,
    WPARAM wParam,
    LPARAM lParam
);

Parameters

Msg

the Message to Post to the Window.
wParam
the WPARAM component sent to the Window with the specified message.
lParam
the LPARAM component sent to the Window with the specified message.

Return Values

If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError. This function returns immediately, and the message gets delivered to the window on a separate thread.

QuickInfo

Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in WinSute.h.
Import Library: Use WinSute.lib & User32.lib

See Also

SWin_BASE::SendMessage


SWin_BASE::repaint

The SWin_BASE::repaint member function forces a repaint in the owned Window.
void repaint(BOOL Erase=FALSE);

Parameters

Erase

This parameter specifies whether the rectangle should first be erased before the repaint. The default value for this is FALSE which specifies that the rectangle NOT be erased first.
Return Values
This function has no return value;

QuickInfo

Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in WinSute.h.
Import Library: Use WinSute.lib & User32.lib

See Also

SRegion::repaint


static SWin_BASE::SaveDialogBoxSendMessage

static SWin_BASE::SaveDialogBox

The static SWin_BASE::SaveDialogBox member function creates a Save-File common DialogBox.
static int  SaveDialogBox(
    FileDialogProc FileDialogProcedure,
    void* param,
    LPTSTR _lpstrFile,
    DWORD _nMaxFile,
    LPCTSTR _lpstrFilter=NULL,
    DWORD _nFilterIndex=0,
    LPCTSTR _lpstrInitialDir=NULL,
    LPCTSTR _lpstrTitle=NULL,
    HWND _Owner=NULL,
    HINSTANCE _hInstance=NULL,
    DWORD _Flags=OFN_PATHMUSTEXIST
);

Parameters

FileDialogProcedure

Function pointer that gets called on Dialog button OK from which further operations may be done using the completed OPENFILENAME.

param

2nd argument to be sent to the FileDialog Procedure.

_lpstrFile

Pointer to a buffer that contains a filename used to initialize the File Name edit control. The first character of this buffer must be NULL if initialization is not necessary. When the GetOpenFileName or GetSaveFileName function returns successfully, this buffer contains the drive designator, path, filename, and extension of the selected file.

If the OFN_ALLOWMULTISELECT flag is set and the user selects multiple files, the buffer contains the current directory followed by the filenames of the selected files. For Explorer-style dialog boxes, the directory and filename strings are NULL separated, with an extra NULL character after the last filename. For old-style dialog boxes, the strings are space separated and the function uses short filenames for filenames with spaces. You can use theFindFirstFile function to convert between long and short filenames.

If the buffer is too small, the function returns FALSE and the CommDlgExtendedError function returns FNERR_BUFFERTOOSMALL. In this case, the first two bytes of the lpstrFile buffer contain the required size, in bytes or characters.

_nMaxFile

Specifies the size, in bytes (ANSI version) or 16-bit characters (Unicode version), of the buffer pointed to by lpstrFile. The GetOpenFileName and GetSaveFileName functions return FALSE if the buffer is too small to contain the file information. The buffer should be at least 256 characters long.

_lpstrFilter

Pointer to a buffer containing pairs of null-terminated filter strings. The last string in the buffer must be terminated by two NULL characters.

The first string in each pair is a display string that describes the filter (for example, "Text Files"), and the second string specifies the filter pattern (for example, "*.TXT").

To specify multiple filter patterns for a single display string, use a semicolon to separate the patterns (for example, "*.TXT;*.DOC;*.BAK"). A pattern string can be a combination of valid filename characters and the asterisk (*) wildcard character. Do not include spaces in the pattern string.

The system does not change the order of the filters. It displays them in the File Types combo box in the order specified in lpstrFilter. If lpstrFilter is NULL, the dialog box does not display any filters.

_nFilterIndex

Specifies the index of the currently selected filter in the File Types control. The buffer pointed to by lpstrFilter contains pairs of strings that define the filters. The first pair of strings has an index value of 1, the second pair 2, and so on. An index of zero indicates the custom filter specified by lpstrCustomFilter. You can specify an index on input to indicate the initial filter description and filter pattern for the dialog box. When the user selects a file, nFilterIndex returns the index of the currently displayed filter.

If nFilterIndex is zero and lpstrCustomFilter is NULL, the system uses the first filter in the lpstrFilter buffer. If all three members are zero or NULL, the system does not use any filters and does not show any files in the file list control of the dialog box.

_lpstrInitialDir

Pointer to a string that specifies the initial file directory.

Windows NT 5.0 and later; Windows 98 and later:

If lpstrInitalDir is NULL and the current directory contains any files of the specified filter types, the initial directory is the current directory.

If lpstrInitalDir is NULL and the current directory does not contain any files of the specified filter types, the initial directory is the personal files directory of the current user. To specify the current user's personal files directory as the initial directory, set lpstrInitialDir to the path returned by calling theSHGetSpecialFolderLocation function with the CSIDL_PERSONAL flag.

Earlier versions of Windows and Windows NT:

If lpstrInitalDir is NULL, the initial directory is the current directory.

_lpstrTitle

Pointer to a string to be placed in the title bar of the dialog box. If this member is NULL, the system uses the default title (that is, Save As or Open).

_Owner

Identifies the window that owns the dialog box. This member can be any valid window handle, or it can be NULL if the dialog box has no owner.

_hInstance

If the OFN_ENABLETEMPLATEHANDLE flag is set in the Flags member, hInstance is the handle of a memory object containing a dialog box template. If the OFN_ENABLETEMPLATE flag is set, hInstance identifies a module that contains a dialog box template named by the lpTemplateName member. If neither flag is set, this member is ignored.

If the OFN_EXPLORER flag is set, the system uses the specified template to create a dialog box that is a child of the default Explorer-style dialog box. If the OFN_EXPLORER flag is not set, the system uses the template to create an old-style dialog box that replaces the default dialog box.

_Flags

A set of bit flags you can use to initialize the dialog box. When the dialog box returns, it sets these flags to indicate the user's input. This member can be a combination of the following flags:

OFN_ALLOWMULTISELECT
OFN_CREATEPROMPT
OFN_ENABLEHOOK
OFN_ENABLESIZING
OFN_ENABLETEMPLATE
OFN_ENABLETEMPLATEHANDLE
OFN_EXPLORER
OFN_EXTENSIONDIFFERENT
OFN_FILEMUSTEXIST
OFN_HIDEREADONLY
OFN_LONGNAMES
OFN_NOCHANGEDIR
OFN_NODEREFERENCELINKS
OFN_NOLONGNAMES
OFN_NONETWORKBUTTON
OFN_NOREADONLYRETURN
OFN_NOTESTFILECREATE
OFN_NOVALIDATE
OFN_OVERWRITEPROMPT
OFN_PATHMUSTEXIST
OFN_READONLY
OFN_SHAREAWARE
OFN_SHOWHELP
Note: For meanings, please see the Microsoft MSDN.

Return Values

If the Cancel button of the DialogBox is used to close the SaveDialogBox, the function will go no further, and will return zero.
If the Cancel button is Not used, the return will be the return of the FileDialogProcedure.

QuickInfo

Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in WinSute.h.
Import Library: Use WinSute.lib & User32.lib

See Also

SWin_BASE::OpenDialogBox


SWin_BASE::SendMessage

The SWin_BASE::SendMessage member function Sends a message to the caller window.
inline LRESULT SendMessage(
    UINT Msg,
    WPARAM wParam,
    LPARAM lParam
);

Parameters

Msg

the Message to Send to the Window.
wParam
the WPARAM component sent to the Window with the specified message.
lParam
the LPARAM component sent to the Window with the specified message.

Return Values

The return value specifies the result of the message processing and depends on the message sent. This function does not return until the Message is delivered to the window, and returned from the Window procedure.

QuickInfo

Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in WinSute.h.
Import Library: Use WinSute.lib & User32.lib

See Also

SWin_BASE::PostMessage


SControl

Scontrol class is the base class to use for easy subclassing of a control. Messages can be captured by simply overriding the appropriate Scontrol virtual function Message Handler, or if it doesn't exist, overriding the 'OnOther' Default Message handler.
Note: After Overriding functions are called, the original Control Message Handler function, is ALWAYS called.

Member Functions:
    public:

    // public member functions

        SControl( int RESOURCE_CODE, // RESOURCE CODE of control
                HSWin_BASE _Parent, // Handle to Parent of Control
                int _Width=0, // Width of ZERO means don't
                                  // change (actual resource)
                int _Height=0 // Height of ZERO means don't change
        );

        SControl( HWND _Button, //	Handle to control window
                HSWin_BASE _Parent, //	Handle to Parent of Control
                int _Width=0, // Width of ZERO means don't change
                int _Height=0 //  Height of ZERO means don't change
        );

        virtual ~SControl ()=0;
        void Create();

    protected:

    // protected virtual functions for overriding

        virtual void OnPaint();
        virtual void OnInit();
        virtual void OnOther(...);
        virtual void OnMouseMove(...);
        virtual void OnMouseLButtonDown(...);
        virtual void OnMouseLButtonUp(...);
        virtual void OnMouseRButtonDown(...);
        virtual void OnMouseRButtonUp(...);
        virtual void OnCaptureChanged(...);

    private:

    // private member functions

        static LRESULT APIENTRY ControlProcedure(...);
        void _OnUser();

Member Variables:

    private:

        LONG OldProc;

Derived Members:

    public:

    // public member functions

        SWin_BASE();
        ~SWin_BASE();

        int MessageBox(...);
        void repaint(...);
        void MoveWindow(...);
        HWND getHWND();
        HINSTANCE getHINSTANCE();
        BOOL PostMessage(...);
        LRESULT SendMessage(...);

    protected:

    // protected member functions to be overridden
    // by derived window classes (eg. SDialog).

        virtual inline void OnShowWindow(...);
        virtual inline void OnSize(...);
        virtual inline void OnSizing(...);
        virtual inline void OnPaint();;
        virtual inline void OnNCDestroy();

Member Variables:

    protected:

        HINSTANCE hInstance;
        HWND hWnd;
        long SWin_Width;
        long SWin_Height;

Remarks

Example usage is provided through the SBuitton class files SButton.h & SButton.cpp.

QuickInfo

Header: Declared in WinSute.h.
Import Library: Use WinSute.lib

See Also

SWin_BASE


SControl::Create

The SControl::Create member function creates the binding between the actual control, and it's subclassing controller.

void SControl::Create();

Parameters

This function requires no parameters, and also returns no value.

Remarks

The SControl::Create member function creates the binding between the actual control, and it's subclassing controller. This function MUST be called before any sub-classing action can take effect.

QuickInfo

Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in WinSute.h.
Import Library: Use WinSute.lib & User32.lib

See Also


SControl::OnMessage

SControl::On"MessageName"

The SControl::On"MessageName" member functions provide a method for handling specific Window Messages as they are sent to it's specific Control. These functions are Virtual and by default do nothing. They are also, often, 'inline' functions to cut down in code and processing time when they are not used.

virtual inline void OnPaint();

virtual inline void OnInit();

virtual inline void OnOther(UINT message, WPARAM wParam, LPARAM lParam);

virtual inline void OnMouseMove(WPARAM wParam, LPARAM lParam);

virtual inline void OnMouseLButtonDown(WPARAM wParam, LPARAM lParam);

virtual inline void OnMouseLButtonUp(WPARAM wParam, LPARAM lParam);

virtual inline void OnMouseRButtonDown(WPARAM wParam, LPARAM lParam);

virtual inline void OnMouseRButtonUp(WPARAM wParam, LPARAM lParam);

virtual inline void OnCaptureChanged(HWND hwndNewCapture);

Remarks

The SControl::On"MessageName" member functions provide a method for handling specific Window Messages as they are sent to it's specific Control. These functions are Virtual and by default do nothing. They are also, often, 'inline' functions to cut down in code and processing time when they are not used.

QuickInfo

Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in WinSute.h.
Import Library: Use WinSute.lib & User32.lib

See Also

SWin_BASE::OnMessage


SDialog

SDialog class is the base class used to create a DialogBox. This Dialogbox may be Modal or Non-Modal depending upon the method of Windows DialogBox Instantiation. Mulitple DialogBoxes may be Instantiated over the life of a single instance of a SDialog class, but only one at a time may be instantiated. DialogBoxes are instantiated through the SDialog::DoModal() function or the SDialog::Create() function.

To create an SDialog Box, simply inherit this function as the base class for a Singular DialogBox class. Override the appropriate Message Handler Member functions to provide the required functionality. The 'OnOther' Message handler function is provided for all those Messages that are not already provided for by an in-built inline function.

Member Functions:

    public:

    // public member functions

        SDialog(int DIALOG_RESOURCE_CODE,
               HWND hwndParent=NULL
        );

        SDialog(int DIALOG_RESOURCE_CODE,
              HINSTANCE _hInstance,
                HWND hwndParent=NULL
        );

        SDialog(LPCTSTR lpTemplate,
              HINSTANCE _hInstance,
              HWND hwndParent=NULL
        );

        virtual ~SDialog()=0;

        HWND Create();
        BOOL Show(...);
        BOOL Hide();
        int DoModal();
        unsigned int getType();
        int setDlgItemText(...); // return 0 is good
                              // return non-zero
        int DlgItemAppendText(...);

    protected:

    // protected member functions

        virtual void OnInitDialog();
        virtual BOOL OnCommand(...);
        virtual BOOL OnNotify(...);
        virtual BOOL OnOther(...);
        virtual void OnClose();
        virtual void OnDestroy();

    private:

        static BOOL CALLBACK DialogProcedure(...);
        LPCTSTR MakeResource();
        void _OnShowWindow(...);
        void _OnSize(...);
        void _OnInitDialog(...);
        void _OnClose();
        void _OnDestroy();
        void Cleanup();
        void CloseWindow(int result);

Member Variables:

    protected:

        HWND parent;

    private:

        unsigned char type;
        unsigned int dialog_resource_code;
        void* resource;

Derived Members:

    public:

    // public member functions

        int MessageBox(...);
        void repaint(...);
        void MoveWindow(...);
        HWND getHWND();
        HINSTANCE getHINSTANCE();
        BOOL PostMessage(...);
        LRESULT SendMessage(...);

    protected:

        virtual inline void OnShowWindow(...);
        virtual inline void OnSize(...);
        virtual inline void OnSizing(...);
        virtual inline void OnPaint();;
        virtual inline void OnNCDestroy();

Member Variables:

    protected:

        HINSTANCE hInstance;
        HWND hWnd;
        long SWin_Width;
        long SWin_Height;

Remarks

Example usage is provided through the following Dialog files: ADialog.h, and ADialog.cpp

QuickInfo

Header: Declared in WinSute.h.
Import Library: Use WinSute.lib

See Also

SWin_BASE, WinMaker_BASE


SDialog::Create

The SDialog::Create member function creates a non-modal Dialog Box.

HWND SDialog::Create();

Parameters

This function requires no parameters.

Return Values

This function returns a handle to the newly created Dialog Box.

Remarks

Unlike the DoModal member function, this function returns immediately.

QuickInfo

Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in WinSute.h.
Import Library: Use WinSute.lib & User32.lib

See Also

SDialog::DoModal


SDialog::DlgItemAppendText

The SDialog:: DlgItemAppendText function appends to the text of a Button, Control, or other Dialog item.

int DlgItemAppendText(
    int DlgItem,
    LPCTSTR lpText
);

Parameters

DlgItem

Resource code which identifies the Item in this DialogBox

lpText

long pointer to a string of characters which is the text to be written to the identified item.

Return Values

This function returns zero in the case of success, or non-zero otherwise. Values may be:
    SUTE_BAD_RESOURCE_ERROR
    SUTE_UNDEFINED_ERROR
    SUTE_NO_SUCH_DIALOG_ERROR
    SUTE_USER_STUPIDITY_ERROR

Remarks

Use the Win32 ::GetLastError to reveal more about possible error causes..

QuickInfo

Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in WinSute.h.
Import Library: Use WinSute.lib & User32.lib

See Also

SDialog::setDlgItemText


SDialog::DoModal

The SDialog::DoModal member function creates a modal Dialog Box.

int SDialog::DoModal();

Parameters

This function requires no parameters.

Return Values

This function returns a user defined value, as specified through the closing Win32 function call

    BOOL EndDialog(
        HWND hDlg, // handle to dialog box
        int nResult // value to return
    );

Note: ::EndDialog is a Win32 Function call. For further information, please use the MSDN or any other reliable Win32 Reference.

Remarks

The SControl::DoModal member function creates a Modal DialogBox. It does not return until the DialogBox has been closed.

QuickInfo

Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in WinSute.h.
Import Library: Use WinSute.lib & User32.lib

See Also

SDialog::Create


SDialog::getType

The function SDialog::getType returns the type of Dialog Box (Modal or Non-Modal) that is currently in existence and attached to this class instance.

unsigned int getType();

Parameters

This function requires no parameters.

Return Values

This function returns the type of Dialog Box in the form of an integer code. This integer code may equal the following values defined within WinSute.h

    _UNSPECIFIED
    _MODAL
    _MODELESS

Remarks

If the DialogBox that has not been Created yet, or it has been destroyed, this function returns UNSPECIFIED.

QuickInfo

Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in WinSute.h.
Import Library: Use WinSute.lib & User32.lib

See Also


SDialog::Hide

The SDialog::Hide member function Hides the Non-Modal DialogBox.

BOOL SDialog::Hide();

Parameters

This function requires no parameters.

Return Values

If the window was previously visible, the return value is nonzero.
If the window was previously hidden, the return value is zero.

Remarks

This function is simply an alternative to using SDialog::Show(SW_HIDE). This function is only available for those Dialog Boxes currently existing as non-modal Dialog Boxes, and has no effect for Modal Dialog Boxes.

QuickInfo

Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in WinSute.h.
Import Library: Use WinSute.lib & User32.lib

See Also

SDialog::Show


SDialog::OnMessage

SDialog::On"MessageName"

The SDialog::On"MessageName" member functions provide a method for handling specific Window Messages as they are sent to it's specific Window. These functions are Virtual and by default do nothing. They are also, often, 'inline' functions to cut down in code and processing time when they are not used.

    virtual inline void OnInitDialog();// unique to dialog

    virtual inline BOOL OnCommand(int IDCode, int notifyCode);
            // OnCommand gets passed -->(LOWORD(wParam), HIWORD (wParam))
            // from the base class message handler

    virtual inline BOOL OnNotify(int IDCode, NMHDR *hdr);
            // OnNotify  gets passed -->(wParam, (NMHDR*)lParam)
            // from the base class message handler

    virtual void OnClose(); // override to control Close
            // override to control WM_DESTROY

    virtual void OnDestroy();

    virtual inline BOOL OnOther(UINT message, WPARAM wParam, LPARAM lParam);
            // This Message is provided to allow users to handle any of the many
            // other messages NOT provided for by the above Message Handler Functions.

Remarks

The SDialog::On"MessageName" member functions provide a method for handling specific Window Messages as they are sent to it's specific Window. These functions are Virtual and by default do nothing. They are also, often, 'inline' functions to cut down in code and processing time when they are not used.

QuickInfo

Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in WinSute.h.
Import Library: Use WinSute.lib & User32.lib

See Also

SWin_BASE::OnMessage


SDialog::setDlgItemText

The SDialog::setDlgItemText function sets the text of a Button, Control, or other Dialog item overwriting the current text.

int setDlgItemText(
    int DlgItem,
    LPCTSTR lpText
);

Parameters

DlgItem

Resource code which identifies the Item in this DialogBox

lpText

long pointer to a string of characters which is the text to be written to the identified item.

Return Values

This function returns zero in the case of success, or non-zero otherwise. Values may be:

    SUTE_BAD_RESOURCE_ERROR
    SUTE_UNDEFINED_ERROR
    SUTE_NO_SUCH_DIALOG_ERROR
    SUTE_USER_STUPIDITY_ERROR

Remarks

Use the Win32 ::GetLastError to reveal more about possible error causes..

QuickInfo

Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in WinSute.h.
Import Library: Use WinSute.lib & User32.lib

See Also


SDialog::Show

The SDialog::Show member function affects the Show state of a Non-Modal DialogBox.

BOOL SDialog::Show(
    int cmd_show=SW_SHOW // default value for show window
);

Parameters

This function may accept 1 parameter which specifies whether to show or hide the window.
The Default value for this parameter is set to SW_SHOW, so by default, when this function is called, the window will be shown. Another possible value for the parameter cmd_show is SW_HIDE (as specified in the MSDN).

Return Values

If the window was previously visible, the return value is nonzero. If the window was previously hidden, the return value is zero.

Remarks

This function is only available for those Dialog Boxes currently existing as non-modal Dialog Boxes, and has no effect for Modal Dialog Boxes.

QuickInfo

Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in WinSute.h.
Import Library: Use WinSute.lib & User32.lib

See Also

SDialog::Hide


SWindow

SWindow class is the base class used to create a regular window. Mulitple Windows may be Instantiated over the life of a single instance of a SWindow class, but only one at a time may be instantiated. Windows are instantiated through the SWindow::Create() function.

To create an SWindow, simply inherit this function as the base class for a Singular Window class. Override the appropriate Message Handler Member functions to provide the required functionality. The 'OnOther' Message handler function is provided for all those Messages that are not already provided for by an in-built inline function.

If a Menu is not required, it is recommended to set the argument MenuID to NO_MENU, as defined in WinSute.h:

#define NO_MENU -1
To easily assign icons to the window (both arguments LargeIcon, and SmallIcon), at is recommended you use the Global Function call MAKE_HICON.

Member Functions:
    public:

    // public member functions

        SWindow(HINSTANCE _hInstance,
              LPCTSTR ClassName,
              UINT style=CS_VREDRAW|CS_HREDRAW,
              int MenuID=NO_MENU,
              HICON LargeIcon=NULL,
              HICON SmallIcon=NULL,
              HBRUSH brush=NULL,
              HCURSOR cursor=NULL,
              int ClassExtra=0
            ) throw (SException)

        virtual ~SWindow()=0

        HWND Create(...) throw (SException);
        BOOL Show(...);
        int GetNumOpenWindows();

    protected:

    // WINDOW MESSAGES

        virtual void OnCreate()
        virtual void OnCommand(...)
        virtual LRESULT OnOther(...)
        virtual void OnNotify(...)
        virtual void OnClose()
        virtual void OnDestroy()

    // KEYBOARD MESSAGES

        virtual void OnChar(...)
        virtual void OnKeyDown(...)
        virtual void OnKeyUp(...)
        virtual void OnSysKeyDown(...)
        virtual void OnSysKeyUp(...)

    private:

    // private member functions

        static LRESULT CALLBACK _wndproc(...)
        void _OnShowWindow(...)
        void _OnSize(...)
        void _OnCreate(...)
        void _OnClose();
        void _OnDestroy();
        void Cleanup();

Member Variables:

    protected:

        WinMaker* winmaker;

    private:

        char created;

Derived Member:

    public:

    // public member functions

        int MessageBox(...);
        void repaint(...);
        void MoveWindow(...);
        HWND getHWND();
        HINSTANCE getHINSTANCE();
        BOOL PostMessage(...);
        LRESULT SendMessage(...);

    protected:

    // protected member functions to be overridden
    // by derived window classes (eg. SDialog).

        virtual inline void OnShowWindow(...);
        virtual inline void OnSize(...);
        virtual inline void OnSizing(...);
        virtual inline void OnPaint();;
        virtual inline void OnNCDestroy();

Member Variables:

    protected:

        HINSTANCE hInstance;
        HWND hWnd;
        long SWin_Width;
        long SWin_Height;

Remarks

Example usage is provided through the following SWindow files: Simple.h, and Simple.cpp

QuickInfo

Header: Declared in WinSute.h.
Import Library: Use WinSute.lib

See Also

SWin_BASE


SWindow::GetNumOpenWindows

The SWindow::GetNumOpenWindows function returns the number of windows opened, for the calling application, created through the WinMaker_BASE class, ie, all Classes inheriting from WinMaker_BASE. This function simply wraps the Parent classes protected member function. see WinMaker_BASE::GetNumOpenWindows.
unsigned int WinMaker_BASE::GetNumOpenWindows();

Parameters

This function requires no parameters

Return Values

This function returns the number of windows registered with the WinMaker key in the System Registry for the application that this function is called from.

Remarks

This function does not include any windows not created through WinMaker_BASE. ie, it will include windows derived from SWindow because SWindow creates it's windows using WinMaker, which in-turn inherits from WinMaker_BASE. Dialog Boxes created through SDialog will ALSO be included because SDialog class directly inherits from WinMaker_BASE.

QuickInfo

Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in WinSute.h.
Import Library: Use WinSute.lib & User32.lib

See Also

WinMaker_BASE::GetNumOpenWindows


SWindow::Create

The SWindow::Create member function creates a non-modal Dialog Box.
HWND Create(
    char* window_title,
    DWORD style,
    HMENU menu,
    int x = CW_USEDEFAULT,
    int y = CW_USEDEFAULT,
    int nWidth = CW_USEDEFAULT,
    int nHeight = CW_USEDEFAULT
    HWND _Parent=NULL
) throw (SException);

Parameters

window_title
A String of characters containing text to place in the Window Title-bar
dwStyle
Specifies the style of the window being created. This parameter can be a combination of the following window styles, plus the control styles indicated in the Remarks section.
Style | Meaning
WS_BORDER | Creates a window that has a thin-line border.
WS_CAPTION | Creates a window that has a title bar (includes the WS_BORDER style).
WS_CHILD | Creates a child window. This style cannot be used with the WS_POPUP style.
WS_CHILDWINDOW | Same as the WS_CHILD style.
WS_CLIPCHILDREN | Excludes the area occupied by child windows when drawing occurs within the parent window. This style is used when creating the parent window.
WS_CLIPSIBLINGS | Clips child windows relative to each other; that is, when a particular child window receives a WM_PAINT message, the WS_CLIPSIBLINGS style clips all other overlapping child windows out of the region of the child window to be updated. If WS_CLIPSIBLINGS is not specified and child windows overlap, it is possible, when drawing within the client area of a child window, to draw within the client area of a neighboring child window.
WS_DISABLED | Creates a window that is initially disabled. A disabled window cannot receive input from the user.
WS_DLGFRAME | Creates a window that has a border of a style typically used with dialog boxes. A window with this style cannot have a title bar.
WS_GROUP | Specifies the first control of a group of controls. The group consists of this first control and all controls defined after it, up to the next control with the WS_GROUP style. The first control in each group usually has the WS_TABSTOP style so that the user can move from group to group. The user can subsequently change the keyboard focus from one control in the group to the next control in the group by using the direction keys.
WS_HSCROLL | Creates a window that has a horizontal scroll bar.
WS_ICONIC | Creates a window that is initially minimized. Same as the WS_MINIMIZE style.
WS_MAXIMIZE | Creates a window that is initially maximized.
WS_MAXIMIZEBOX | Creates a window that has a Maximize button. Cannot be combined with the WS_EX_CONTEXTHELP style. The WS_SYSMENU style must also be specified.
WS_MINIMIZE | Creates a window that is initially minimized. Same as the WS_ICONIC style.
WS_MINIMIZEBOX | Creates a window that has a Minimize button. Cannot be combined with the WS_EX_CONTEXTHELP style. The WS_SYSMENU style must also be specified.
WS_OVERLAPPED | Creates an overlapped window. An overlapped window has a title bar and a border. Same as the WS_TILED style.
WS_OVERLAPPEDWINDOW | Creates an overlapped window with the WS_OVERLAPPED, WS_CAPTION, WS_SYSMENU, WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX styles. Same as the WS_TILEDWINDOW style.
WS_POPUP | Creates a pop-up window. This style cannot be used with the WS_CHILD style.
WS_POPUPWINDOW | Creates a pop-up window with WS_BORDER, WS_POPUP, and WS_SYSMENU styles. The WS_CAPTION and WS_POPUPWINDOW styles must be combined to make the window menu visible.
WS_SIZEBOX | Creates a window that has a sizing border. Same as the WS_THICKFRAME style.
WS_SYSMENU | Creates a window that has a window-menu on its title bar. The WS_CAPTION style must also be specified.
WS_TABSTOP | Specifies a control that can receive the keyboard focus when the user presses the tab key. Pressing the tab key changes the keyboard focus to the next control with the WS_TABSTOP style.
WS_THICKFRAME | Creates a window that has a sizing border. Same as the WS_SIZEBOX style.
WS_TILED | Creates an overlapped window. An overlapped window has a title bar and a border. Same as the WS_OVERLAPPED style.
WS_TILEDWINDOW | Creates an overlapped window with the WS_OVERLAPPED, WS_CAPTION, WS_SYSMENU, WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX styles. Same as the WS_OVERLAPPEDWINDOW style.
WS_VISIBLE | Creates a window that is initially visible.
WS_VSCROLL | Creates a window that has a vertical scroll bar.
hMenu
Handle to a menu, or specifies a child-window identifier depending on the window style. For an overlapped or pop-up window, hMenu identifies the menu to be used with the window; it can be NULL if the class menu is to be used. For a child window, hMenu specifies the child-window identifier, an integer value used by a dialog box control to notify its parent about events. The application determines the child-window identifier; it must be unique for all child windows with the same parent window.
x
Specifies the initial horizontal position of the window. For an overlapped or pop-up window, the x parameter is the initial x-coordinate of the window's upper-left corner, in screen coordinates. For a child window, x is the x-coordinate of the upper-left corner of the window relative to the upper-left corner of the parent window's client area.
If this parameter is set to CW_USEDEFAULT, the system selects the default position for the window's upper-left corner and ignores the y parameter. CW_USEDEFAULT is valid only for overlapped windows; if it is specified for a pop-up or child window, the x and y parameters are set to zero.
y
Specifies the initial vertical position of the window. For an overlapped or pop-up window, the y parameter is the initial y-coordinate of the window's upper-left corner, in screen coordinates. For a child window, y is the initial y-coordinate of the upper-left corner of the child window relative to the upper-left corner of the parent window's client area. For a list box, y is the initial y-coordinate of the upper-left corner of the list box's client area relative to the upper-left corner of the parent window's client area.
If an overlapped window is created with the WS_VISIBLE style bit set and the x parameter is set to CW_USEDEFAULT, the system ignores the y parameter.
nWidth
Specifies the width, in device units, of the window. For overlapped windows, nWidth is either the window's width, in screen coordinates, or CW_USEDEFAULT. If nWidth is CW_USEDEFAULT, the system selects a default width and height for the window; the default width extends from the initial x-coordinate to the right edge of the screen, and the default height extends from the initial y-coordinate to the top of the icon area. CW_USEDEFAULT is valid only for overlapped windows; if CW_USEDEFAULT is specified for a pop-up or child window, nWidth and nHeight are set to zero.
nHeight
Specifies the height, in device units, of the window. For overlapped windows, nHeight is the window's height, in screen coordinates. If nWidth is set to CW_USEDEFAULT, the system ignores nHeight.

_Parent
the Parent Window of the window to be created (if it is a child).

Return Values
This function returns a handle to the newly created Window.

QuickInfo

Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in WinSute.h.
Import Library: Use WinSute.lib & User32.lib

See Also


SWindow::OnMessage

SWindow::On"MessageName"

The SWindow::On"MessageName" member functions provide a method for handling specific Window Messages as they are sent to it's specific Window. These functions are Virtual and by default do nothing. They are also, often, 'inline' functions to cut down in code and processing time when they are not used.

virtual void OnCreate();

virtual void OnCommand(
    WPARAM wParam,
    LPARAM lParam
);

virtual LRESULT OnOther(	// return non-zero if didn't handle message,
    UINT message,	// zero if handled message
    WPARAM wParam,
    LPARAM lParam
);

virtual void OnNotify(
    WPARAM wParam,
    LPARAM lParam
);

virtual void OnClose();

virtual void OnDestroy(){
    PostQuitMessage(0);  // default action
}

// KEYBOARD MESSAGES

virtual void OnChar(
    WPARAM wParam,
    LPARAM lParam
);

virtual void OnKeyDown(
    WPARAM wParam,
    LPARAM lParam
);

virtual void OnKeyUp(
    WPARAM wParam,
    LPARAM lParam
);

virtual void OnSysKeyDown(
    WPARAM wParam,
    LPARAM lParam
);

virtual void OnSysKeyUp(
    WPARAM wParam,
    LPARAM lParam
);

Remarks

The SWindow::On"MessageName" member functions provide a method for handling specific Window Messages as they are sent to it's specific Window. These functions are Virtual and by default, often do nothing. They are also, often, 'inline' functions to cut down in code and processing time when they are not used.

QuickInfo

Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in WinSute.h.
Import Library: Use WinSute.lib & User32.lib

See Also

SWin_BASE::OnMessage


SWindow::Show

The SWindow::Show member function affects the Show state of a Window.
BOOL SWindow::Show(
    int cmd_show=SW_SHOW // default value for show window
);

Parameters

This function may accept 1 parameter which specifies whether to show or hide the window.
The Default value for this parameter is set to SW_SHOW, so by default, when this function is called, the window will be shown.
Another possible value for the parameter cmd_show is SW_HIDE (as specified in the MSDN).

Return Values

If the window was previously visible, the return value is nonzero.
If the window was previously hidden, the return value is zero.

Remarks

See the Microsoft MSDN for more details on cmd_show.

QuickInfo

Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in WinSute.h.
Import Library: Use WinSute.lib & User32.lib

See Also