//////////////////////////////////////////////////////////////////////////////////////
//cWindows header
/////////////////////////////////////////////////////////////////////////////////////
#include //Necessary windows funcs. and macros.
class Win;
////////////////////////////////////////////////////////////////////////////////////////////////
//Windows initialization
//////////////////////////////////////////////////////////////////////////////////////////////////
class Win
{
public:
void WinInit(HINSTANCE hInstance);
bool CreateWin(char *WinName, HINSTANCE hInstance);
static LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
private:
WNDCLASSEX m_wClass;
HWND hWnd;
}; //End of definition
void Win::WinInit(HINSTANCE hInstance)
{
m_wClass.cbSize = sizeof(WNDCLASSEX);
m_wClass.cbClsExtra = 0;
m_wClass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
m_wClass.cbWndExtra = 0;
m_wClass.hCursor = LoadCursor(NULL, IDC_ARROW);
m_wClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
m_wClass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
m_wClass.lpfnWndProc = WndProc;
m_wClass.lpszClassName = "Window Class";
m_wClass.lpszMenuName = NULL;
m_wClass.style = CS_HREDRAW|CS_VREDRAW;
m_wClass.hInstance = hInstance;
}
bool Win::CreateWin(char *WinName, HINSTANCE hInstance)
{
hWnd = CreateWindowEx(NULL,
"Window Class", WinName,
WS_OVERLAPPEDWINDOW|WS_VISIBLE,100,100,
640,480,NULL, NULL,hInstance, NULL);
if(hWnd==NULL)
return false;
return true;
}
LRESULT CALLBACK Win::WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_DESTROY:
{
PostQuitMessage(0);
return 0;
}break;
}
return DefWindowProc(hWnd, msg, wParam, lParam);
}
sHaKaZeDhttp://www26.brinkster.com/shakazed/