   I want your thoughts on my windows class.
  I wrote a windows class, tell me what you think I could do to improve it. Here it is:   #include <windows.h>class AppWindow{private:HWND hwnd;MSG msg;WNDCLASS wc;public:AppWindow(HINSTANCE hinst){wc.cbClsExtra = 0;wc.cbWndExtra = 0;wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);wc.hCursor = LoadCursor(NULL,IDC_ARROW);wc.hIcon = LoadIcon(NULL,IDI_APPLICATION);wc.hInstance = hinst;wc.lpfnWndProc = WndProc;wc.lpszClassName = "Class";wc.lpszMenuName = NULL;wc.style = CS_VREDRAW|CS_HREDRAW;RegisterClass(&wc);hwnd = CreateWindow("Class","Window",WS_OVERLAPPEDWINDOW,0,0,CW_USEDEFAULT,CW_USEDEFAULT,NULL,NULL,hinst,NULL);}AppWindow(HINSTANCE hinst,int sizex,int sizey){wc.cbClsExtra = 0;wc.cbWndExtra = 0;wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);wc.hCursor = LoadCursor(NULL,IDC_ARROW);wc.hIcon = LoadIcon(NULL,IDI_APPLICATION);wc.hInstance = hinst;wc.lpfnWndProc = WndProc;wc.lpszClassName = "Class";wc.lpszMenuName = NULL;wc.style = CS_VREDRAW|CS_HREDRAW;RegisterClass(&wc);hwnd = CreateWindow("Class","Window",WS_OVERLAPPEDWINDOW,0,0,sizex,sizey,NULL,NULL,hinst,NULL);}AppWindow(HINSTANCE hinst,int locx,int locy,int sizex,int sizey){wc.cbClsExtra = 0;wc.cbWndExtra = 0;wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);wc.hCursor = LoadCursor(NULL,IDC_ARROW);wc.hIcon = LoadIcon(NULL,IDI_APPLICATION);wc.hInstance = hinst;wc.lpfnWndProc = WndProc;wc.lpszClassName = "Class";wc.lpszMenuName = NULL;wc.style = CS_VREDRAW|CS_HREDRAW;RegisterClass(&wc);hwnd = CreateWindow("Class","Window",WS_OVERLAPPEDWINDOW,locx,locy,sizex,sizey,NULL,NULL,hinst,NULL);}static LRESULT CALLBACK WndProc(HWND hWnd,UINT imsg, WPARAM wParam,LPARAM lParam){switch(imsg){case WM_DESTROY:PostQuitMessage(0);break;}return DefWindowProc(hWnd,imsg,wParam,lParam);}    void Display(int i){UpdateWindow(hwnd);ShowWindow(hwnd,i);while(GetMessage(&msg,NULL,0,0)){TranslateMessage(&msg);DispatchMessage(&msg);}}};Thanks,Cory   Favorite Quotes:Gandalf: You shall not pass!|Smeagol: We don''t need you!|Sloth: Hey you guys!|    
  So what are planning on using this for?  I mean, it looks good, but as it stands, by itself, it doesn''t have any practical purpose except for keeping everything organized.  Which is fine I suppose.   ;  Read Creating a Win32 Window Wrapper Class (by yours truly). Use default parameters so you don''t have three nearly identical constructors. The WINDOWCLASS[EX] is a very temporary structure; it doesn''t make sense to store it as an object member. Allow users to pass WINDOWCLASS[EX] instances to a constructor. ;  hey i made one aswell, but i noticed that mine lacked the use of hinst.what is hinst for anyway? mine seems to run fine without it. although i am using my window class to purely create a window, and ive got a d3d class for drawing.source if u want to see what i may be doing wrong. class Window {private:int wWidth;int wHeight;HWND hWnd;static LRESULT WINAPI MsgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ){switch( msg ){case WM_DESTROY:PostQuitMessage(0); return 0;break;}return DefWindowProc( hWnd, msg, wParam, lParam );}public:int getWindowWidth(){return wWidth;}int getWindowHeight(){return wHeight;}Window(){hWnd = NULL;}HWND getHWND(){return hWnd;}void close(){PostQuitMessage(0); }void create(char name[], char caption[], int width, int height,bool border, void initialise(), void loop(), void uninitialise()){wWidth=width;wHeight=height;WNDCLASSEX wc= { sizeof(WNDCLASSEX), CS_CLASSDC, MsgProc, 0, 0, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, name, NULL};RegisterClassEx( &wc );if (border) hWnd = CreateWindow(name, caption, WS_OVERLAPPEDWINDOW , 0, 0, width, height, GetDesktopWindow(), NULL, wc.hInstance, NULL );elsehWnd = CreateWindow(name, caption, WS_POPUP , 0, 0, width, height, GetDesktopWindow(), NULL, wc.hInstance, NULL );ShowWindow( hWnd, SW_SHOWDEFAULT );UpdateWindow( hWnd );MSG msg;ZeroMemory( &msg, sizeof(msg) );PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE);if (initialise!=NULL)initialise();while (msg.message!=WM_QUIT) {if (PeekMessage( &msg, NULL, 0, 0, PM_REMOVE)) {TranslateMessage(&msg);DispatchMessage(&msg);} else {if (loop!=NULL)loop();}}if (uninitialise!=NULL)uninitialise();UnregisterClass(name, wc.hInstance );}};