A object-oriented wrapper for the windows window procedure.
Example:
class Window : public ww::WindowBase<Window> {
public:
LRESULT CALLBACK HandleMessage(UINT Message, WPARAM WParam, LPARAM LParam) override {
// Handle messages here
}
static constexpr LPCTSTR ClassName = "my_window_class";
};
This replaces the WindowProc function. The parameters Message
, WParam
and LParam
are the parameters passed to the internal WindowProc function.
The window handle is not passed as an argument as it can be accessed as a member of the window class.
This defines the name of the window class the window uses. This does not have to be unique across multiple window classes.
Example:
Window wnd;
ww::CreateStruct params = {...};
wnd.Create(params);
wnd.Show(nCmdShow);
Creates the window with the given parameters.
Shows the window in the given show mode.
The first time this is called this should be the nCmdShow
parameter passed obtained by the WinMain
.
For more information about this value see the ShowWindow documentation.
The struct is defined as
struct CreateStruct {
LPCTSTR Name;
int Width = CW_USEDEFAULT;
int Height = CW_USEDEFAULT;
int X = CW_USEDEFAULT;
int Y = CW_USEDEFAULT;
HWND Parent = NULL;
LONG Style = WS_OVERLAPPEDWINDOW;
HMENU Menu = NULL;
DWORD ExStyle = 0;
};
Fields:
Name
- The window titleWidth
,Heigh
- The dimensions of the windowX
,Y
- The position of the windowParent
- The parent windowStyle
- The window styleMenu
- The menu to useExStyle
- The extended window style