   Errors getting my d3d class to work with my windows class.
  I'm trying to get my windows class in EZWindow.h to work with my Direct3D init class in main.cpp. I will post the code and the errors.   #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);}}MSG GetWinMessage(){return msg;}HWND GetWinHwnd(){return hwnd;}};#include<windows.h>#include<d3d9.h>#include<d3dx9.h>#include<EZWindow.h>#pragma comment(lib,"d3d9.lib")#pragma comment(lib,"d3dx9.lib")class D3DWindow{private:IDirect3D9 *pd3d;IDirect3DDevice9 *pd3dd;D3DPRESENT_PARAMETERS d3dpp;D3DDISPLAYMODE d3ddm;public:D3DWindow(HWND hWnd, int SIZEX,int SIZEY){pd3d = Direct3DCreate9(D3D_SDK_VERSION);pd3d->GetAdapterDisplayMode(D3DADAPTER_DEFAULT,&d3ddm);d3ddm.Width = SIZEX;d3ddm.Height = SIZEY;d3ddm.RefreshRate = 0;d3ddm.Format = D3DFMT_R5G6B5;ZeroMemory(&d3dpp,sizeof(d3dpp));d3dpp.Windowed = false;d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;d3dpp.BackBufferFormat = d3ddm.Format;d3dpp.EnableAutoDepthStencil = FALSE;pd3d->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,hWnd,D3DCREATE_SOFTWARE_VERTEXPROCESSING,&d3dpp,&pd3dd);}~D3DWindow(){if(pd3d != NULL){pd3d->Release();pd3d = NULL;}if(pd3dd != NULL){pd3dd->Release();pd3dd = NULL;}}BOOL DisplayScene(){pd3dd->Clear(0,NULL,D3DCLEAR_TARGET,D3DCOLOR_RGBA(0,64,128,255),1.0f,0);pd3dd->BeginScene();pd3dd->EndScene();pd3dd->Present(NULL,NULL,NULL,NULL);}};LRESULT CALLBACK WndProc(HWND hwnd,UINT iMsg,WPARAM wParam,LPARAM lParam){switch(iMsg){case WM_DESTROY:PostQuitMessage(0);break;}}int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hpInstance,PSTR cmdLine,int iCmd){AppWindow window(hInstance,0,0,GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN));D3DWindow d3d(hwnd,GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN));while(window.GetWinMessage() != WM_DESTROY){GetMessage(window.GetWinMessage(),window.GetWinHwnd(),0,0){TranslateMessage(&window.GetMessage());DispatchMessage(&window.GetMessage());}d3d.DisplayScene();}}--------------------Configuration: DX9NOW - Win32 Debug--------------------Compiling...main.cppc:\program files\microsoft visual studio\vc98\include\ezwindow.h(51) : error C2061: syntax error : identifier 'hwnd'C:\DOCUMENTS AND SETTINGS\CORY FISHER\DESKTOP\TEST\DX9NOW\main.cpp(55) : error C2065: 'hwnd' : undeclared identifierC:\DOCUMENTS AND SETTINGS\CORY FISHER\DESKTOP\TEST\DX9NOW\main.cpp(56) : error C2678: binary '!=' : no operator defined which takes a left-hand operand of type 'struct tagMSG' (or there is no acceptable conversion)C:\DOCUMENTS AND SETTINGS\CORY FISHER\DESKTOP\TEST\DX9NOW\main.cpp(56) : fatal error C1903: unable to recover from previous error(s); stopping compilationError executing cl.exe.DX9NOW.exe - 4 error(s), 0 warning(s)[edited by - ssjcory on February 17, 2004 5:50:57 PM]
  I haven''t got the time right now, but I took a 30 second look at your code and errors and I noticed that you sometimes refer to the HWND as hWnd and hwnd. Not sure, but that might be a cause of your error. The other thing is, shouldn''t your HWND GetWinHwnd() return a pointer to Hwnd? ie HWND* GetWinHwnd().I''ll take a better look later on when I more that half a minute to spare. ;  Can you emsil me the source so I can try compiling it?Jeremy_king@dell.com ;  I get no erros it just wont display  ;  In your WinMain function, you should specify some way to pass the HWND from your Window class to your Graphics class.  You should also break from your message loop when you get WM_QUIT, not WM_DESTROY.  WM_DESTROY should trigger WM_QUIT (although I''m not sure if that''s a problem).  Oh, and try passing NULL as the window handle in GetMessage instead of your actual window handle, it might be that you''re not picking up messages after your window dies.As of Direct3D9, I think you can just specify D3DFMT_UNKNOWN for your back buffer format in windowed mode, so you don''t have to get the current format information.  You may also want to wrap your IDirect3DDevice9 object in a CComPtr<>, from atlbase.h.  It''s not necessary, but it''s a smart pointer for COM objects.I apologize for not actually having fixed any of your code. 