Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

Control creating/destroying
[Windowing functions]

Defines

Typedefs

Functions


Define Documentation

#define CreateWindow class_name,
caption,
style,
id,
x,
y,
w,
h,
parent,
add_data   ) 
 

Value:

CreateWindowEx(class_name, caption, style, 0,   \
                        id, x, y, w, h, parent, add_data)
A simplified version of CreateWindowEx.

See also:
CreateWindowEx

Definition at line 5201 of file window.h.


Typedef Documentation

typedef void(* NOTIFPROC)(HWND hwnd, int id, int nc, DWORD add_data)
 

Type of the notification callback procedure.

This is the function type of Notification Callback Procedure. If you set the Notification Callback Procedure for a control, when a notification occurred the control will call this callback procedure.

See also:
SetNotificationCallback

Definition at line 5148 of file window.h.


Function Documentation

HWND GUIAPI CreateWindowEx const char *  spClassName,
const char *  spCaption,
DWORD  dwStyle,
DWORD  dwExStyle,
int  id,
int  x,
int  y,
int  w,
int  h,
HWND  hParentWnd,
DWORD  dwAddData
 

Creates a child window with extended style.

This function creates a child window (also known as "control") with extended style. It specifies the window class, the window title, the window style, the window extended style, the initial position, and the size of the window. The function also specifies the window's parent or owner.

Parameters:
spClassName The class name of the control.
spCaption The caption of the control.
dwStyle The control style.
dwExStyle The extended control style.
id The identifier of the control.
x x,y: The initial position of the control in the parent window.
y x,y: The initial position of the control in the parent window.
w The initial width of the control.
h The initial height of the control.
hParentWnd The handle to the parent window.
dwAddData The first private additional data of the control. Note that some control classes use this value to initialize some properties of the new control instance. For these control classes, you should pass a valid value to it.
Returns:
The handle to the new control, HWND_INVALID on error.
See also:
CreateMainWindow, CTRLDATA
Example:

/*
 * The following code creates some controls when handling the MSG_CREATE message.
 */
#define IDC_STATIC1     100
#define IDC_STATIC2     150
#define IDC_BUTTON1     110
#define IDC_BUTTON2     120
#define IDC_EDIT1       130
#define IDC_EDIT2       140

int ControlTestWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
{
        static HWND hStaticWnd1, hStaticWnd2, hButton1, hButton2, hEdit1, hEdit2;
        switch (message) {
        case MSG_CREATE:
        {
            hStaticWnd1 = CreateWindow (CTRL_STATIC, 
                                        "This is a static control", 
                                        WS_CHILD | SS_NOTIFY | SS_SIMPLE | WS_VISIBLE | WS_BORDER,
                                        IDC_STATIC1, 
                                        10, 10, 180, 300, hWnd, 0);
            hButton1    = CreateWindow (CTRL_BUTTON,
                                        "Button1", 
                                        WS_CHILD | BS_PUSHBUTTON | WS_VISIBLE, 
                                        IDC_BUTTON1, 
                                        20, 20, 80, 20, hStaticWnd1, 0);
            hButton2    = CreateWindow (CTRL_BUTTON,
                                        "Button2", 
                                        WS_CHILD | BS_PUSHBUTTON | WS_VISIBLE, 
                                        IDC_BUTTON2, 
                                        20, 50, 80, 20, hStaticWnd1, 0);
            hEdit1      = CreateWindow (CTRL_EDIT,
                                        "Edit Box 1", 
                                        WS_CHILD | WS_VISIBLE | WS_BORDER, 
                                        IDC_EDIT1, 
                                        20, 80, 100, 24, hStaticWnd1, 0);
            hStaticWnd2 = CreateWindow (CTRL_STATIC, 
                                        "This is child static control", 
                                        WS_CHILD | SS_NOTIFY | SS_SIMPLE | WS_VISIBLE | WS_BORDER,
                                        IDC_STATIC1, 
                                        20, 110, 100, 50, hStaticWnd1, 0);
            hEdit2      = CreateWindow (CTRL_EDIT,
                                        "Edit Box 2", 
                                        WS_CHILD | WS_VISIBLE | WS_BORDER, 
                                        IDC_EDIT2, 
                                        0, 20, 100, 24, hStaticWnd2, 0);
           break;
          }

.......

    }

    return DefaultMainWinProc (hWnd, message, wParam, lParam);
}

BOOL GUIAPI DestroyWindow HWND  hWnd  ) 
 

Destroys a specified control.

This function destroys the specified control hWnd, which is created by CreateWindowEx.

Parameters:
hWnd The handle to the control.
Returns:
TRUE on success, FALSE on error.
See also:
CreateWindowEx

NOTIFPROC GUIAPI GetNotificationCallback HWND  hwnd  ) 
 

Gets the notification callback procedure of a control.

This function gets the new notification callback procedure of the control of hwnd.

Parameters:
hwnd The handle to the control.
Returns:
The notification callback procedure.
See also:
NOTIFPROC, SetNotificationCallback

NOTIFPROC GUIAPI SetNotificationCallback HWND  hwnd,
NOTIFPROC  notif_proc
 

Sets a new notification callback procedure for a control.

This function sets the new notification callback procedure (notif_proc) for the control of hwnd.

By default, the notification from a control will be sent to its parent window within a MSG_COMMAND messsage.

Since version 1.2.6, MiniGUI defines the Notification Callback Procedure for control. You can specify a callback function for a control by calling SetNotificationCallback to receive and handle the notifications from the control.

If you did not set the notification callback function for a control, the notification will be sent to its parent as same as the earlier version of MiniGUI.

Parameters:
hwnd The handle to the control.
notif_proc The new notification callback procedure, can be NULL.
Returns:
The old notification callback procedure.
See also:
NOTIFPROC, GetNotificationCallback


Generated on Mon Jun 26 13:54:32 2006 for MiniGUI V1.6.9 API Reference by  doxygen 1.4.2