int _x; // horizontal position of window
int _y; // vertical position of window
int _width; // window width
int _height; // window height
HWND _hWndParent; // handle to parent or owner window
HMENU _hMenu; // handle to menu, or child-window id
void * _data; // pointer to window-creation data
};
WinMaker::WinMaker(WinClass& winclass) : _hwnd(0), _class(winClass), _exStyle(0), // extended window style
_windowName (0), // pointer to window name
_style(WS_OVERLAPPED), // window style
_x(CW_USEDEFAULT), // horizontal position of window
_y(0), // vertical position of window
_width(CW_USEDEFAULT), // window width
_height(0), // window height
_hWndParent(0), // handle to parent or owner window
_hMenu(0), // handle to menu, or child-window id
_data(0) // pointer to window-creation data
{ }
void WinMaker::Create() {
_hwnd = ::CreateWindowEx(_exStyle, _class.GetName(), _windowName, _style, _x, _y, _width, _height, _hWndParent, _hMenu, _class.GetInstance(), _data);
if (_hwnd == 0) throw WinException ("Internal error: Window Creation Failed.");
}
void WinMaker::Show(int nCmdShow) {
::ShowWindow(_hwnd, nCmdShow);
::UpdateWindow(_hwnd);
}
// Makes top overlapped window with caption
TopWinMaker::TopWinMaker((WinClass& winclass, char const* caption) : WinMaker(winClass) {
_style = WS_OVERLAPPEDWINDOW | WS_VISIBLE;