Problem mit CreateWindow(...)
-
hallo! erst mal mein code
#include "main.h" LRESULT CALLBACK WindowProc(HWND hWindow,UINT uMessage,WPARAM wParam,LPARAM lParam); void InitWindow(int iWidth,int iHeight,char *pcName,HICON hIcon); int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nShowCmd) { InitWindow(800,600,"Hallooo",NULL); return 0; } void InitWindow(int iWidth,int iHeight,char *pcName,HICON hIcon) { WNDCLASSEX WindowClass = {sizeof(WNDCLASSEX), CS_CLASSDC, WindowProc, 0,0,GetModuleHandle(NULL),hIcon,NULL,NULL,NULL,"Direct3D Window",NULL}; if(!RegisterClassEx(&WindowClass)) { MessageBox(NULL,"Error","Fehler",MB_OK); } RECT rect; SetRect(&rect,0,0,iWidth,iHeight); AdjustWindowRect(&rect,WS_VISIBLE,FALSE); iWidth=rect.right-rect.left; iHeight=rect.bottom-rect.top; g_hWindow=CreateWindow("Direct3D", pcName, WS_VISIBLE | WS_OVERLAPPEDWINDOW, GetSystemMetrics(SM_CXSCREEN)/2-iWidth/2, GetSystemMetrics(SM_CYSCREEN)/2-iHeight/2, iWidth, iHeight, NULL, NULL, GetModuleHandle(NULL), NULL); if(!g_hWindow) { char error[1024]; sprintf_s(error,"%d",GetLastError()); MessageBox(NULL,error,"Error",MB_OK); } } LRESULT CALLBACK WindowProc(HWND hWindow,UINT uMessage,WPARAM wParam,LPARAM lParam) { return DefWindowProc(hWindow,uMessage,wParam,lParam); }die messagbox wirft den error-code 1407
kann mir da jemand weiterhelfen?
-
Aus winerror.h:
#define ERROR_CANNOT_FIND_WND_CLASS 1407L
-
http://msdn.microsoft.com/en-us/library/ms681385(v=VS.85).aspx
=> 1407 (0x57F) Cannot find window class.
CreateWindow("Direct3D", pcName,...), Du hast deine Klasse aber "Direct3D Window" genannt ...
-
DANKEEEE
