Easy Win 32
Window
Class – cEasyWindow
cEasyWindow Public Members:
HWND window;
WNDCLASSEX windowclass;
cEasyWindow Functions:
Functions to modify and/or set up
the window handle (HWND window):
int ChangeWindowInstance(HINSTANCE);
int ChangeWindowParent(HWND)
int ChangeWindowMenu(HMENU)
int ChangeWindowPos(int x, int y, int
Width, int Height)
int ChangeWindowStyles(DWORD
dwstyle,DWORD dwexstyle)
int ChangeWindowName(LPCTSTR)
As a general rule, this functions
return 1 on success and 0 on error.
Functions to modify and/or setup
the window class (WNDCLASSEX windowclass):
int ChangeClassStyle(UINT)
int ChangeClassInstance(HINSTANCE)
int ChangeClassSize(UINT
cbSize, int cbClsExtra, int cbWndExtra)
int ChangeClassIcon(HICON)
int ChangeClassIconSm(HICON)
int ChangeClassCursor(HCURSOR)
int ChangeClassBrush(HBRUSH)
int ChangeClassMenuName(LPCTSTR)
int ChangeClassName(LPCTSTR)
int ChangeClassProc(WNDPROC)
As a general rule, this functions
return 1 on success and 0 on error.
Other Functions:
void InitWindow()
As it name says, it Initializes the Window Class with the following values:
cbSize=sizeof(WNDCLASSEX);
style=CS_GLOBALCLASS|CS_HREDRAW|CS_VREDRAW;
lpfnWndProc=NULL;
cbClsExtra=0;
cbWndExtra=0;
hInstance=programInstance;
hIcon=LoadIcon(NULL,IDI_APPLICATION);
hCursor=LoadCursor(programInstance,IDC_ARROW);
hbrBackground=GetSysColorBrush(COLOR_WINDOW);
lpszMenuName=NULL;
lpszClassName=NULL;
hIconSm=NULL;
_classregistered_=FALSE;
lpWindowName="Window";
dwStyle=WS_OVERLAPPEDWINDOW;
x=10;
y=10;
nWidth=300;
nHeight=300;
hWndParent=NULL;
hMenu=NULL;
hInst1=programInstance;
_windowcreated_=FALSE;
int Register_Class()
Registers the windowclass. Function (API) used: RegisterClassEx(…).
Returns 1 on success, 0 on error.
HWND Create_Window(LPCTSTR
AuxiliarClassName)
Creates
the window. In case you have another Window Class you would like to use, please
feel free to send it’s name as a parameter, otherwise
use NULL.
Function (API)
used: CreateWindowEx(…).
On success it
returns the Window Handle (You don´t need to store
it, it is already stored in the public variable “window”).
On error returns
NULL.
int Destroy_Window()
Destroys the Window. On error returns 0, else non-zero.
int CloseWindow()
Close the Window. On error returns 0, else non-zero.
int GetWindowPos(LPRECT Coord)
LONG
GetWindowId()
HWND
GetWindowParent()
DWORD
GetWindowExStyle()
DWORD
GetWindowStyle()
HINSTANCE
GetWindowInstance()
This
functions return a Window Property according to the name of the function.
BOOL Is_Enabled()
If the Window is Enabled, returns TRUE, else
FALSE.
void Disable_Window()
void Enable_Window()
Disable or Enable the Window.
cEasyWindow Private Members:
Variables for the Window Class:
UINT cbSize;
UINT style;
WNDPROC lpfnWndProc;
int cbClsExtra;
int cbWndExtra;
HANDLE hInstance;
HICON hIcon;
HCURSOR hCursor;
HBRUSH hbrBackground;
LPCTSTR lpszMenuName;
LPCTSTR lpszClassName;
HICON hIconSm;
BOOL _classregistered_;
Variables for the Window Handle:
DWORD dwExStyle; //
extended window style
LPCTSTR lpWindowName; //
pointer to window name
DWORD dwStyle; // window
style
int x; //
horizontal position of window
int y; //
vertical position of window
int nWidth; // window width
int nHeight; // window height
HWND hWndParent; // handle to parent or owner window
HMENU hMenu; //
handle to menu or child-window identifier
HANDLE hInst1; // handle to application instance
BOOL _windowcreated_;