W
Hi Leute,
ich versuche schon die ganze Zeit, einem Child Fenster ein eigenes Handle zuzuweisen. Dazu gebe ich ihm eine CALLBACK und registreire es in der RegisterClass. Aber irgendwie will das nicht so wirklich funktionieren.
BOOL CreateGLWindow(char *Winname,int width,int height,int bits,bool fullscreenflag)
{
GLuint PixelFormat;
WNDCLASS wc;
DWORD dwExStyle;
DWORD dwStyle;
RECT WindowRect;
fullscreenflag=fullscreen;
WindowRect.left=(long)0;
WindowRect.right=(long)width;
WindowRect.top=(long)0;
WindowRect.bottom=(long)height;
hInstance = GetModuleHandle(NULL);
wc.hInstance = hInstance;
wc.lpfnWndProc=(WNDPROC)WndProc;
wc.lpszMenuName=NULL;
wc.lpszClassName="OpenGL";
wc.style=CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
wc.hbrBackground=NULL;
wc.cbClsExtra=0;
wc.cbWndExtra=0;
wc.hIcon=LoadIcon(NULL,IDI_APPLICATION);
wc.hCursor=LoadCursor(NULL,IDC_ARROW);
if(!RegisterClass(&wc))
{
MessageBox(NULL,"Fehler in der Registry-Anweisung !","Error",MB_OK);
return FALSE;
}
RegisterClass(&wc);
wc.lpfnWndProc = Child_view;
wc.lpszClassName = NULL;
RegisterClass(&wc);
wc.cbWndExtra = sizeof(int);
wc.hbrBackground = (HBRUSH) GetStockObject(LTGRAY_BRUSH);
if(fullscreen)
{
DEVMODE dmScreenSettings;
dmScreenSettings.dmPelsWidth=width;
dmScreenSettings.dmPelsHeight=height;
dmScreenSettings.dmBitsPerPel=bits;
dmScreenSettings.dmFields=DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
}
if(fullscreen)
{
dwExStyle=WS_EX_WINDOWEDGE;
dwStyle=WS_POPUP;
ShowCursor(TRUE);
}
else
{
dwExStyle=WS_EX_APPWINDOW;
dwStyle=WS_OVERLAPPEDWINDOW;
}
AdjustWindowRectEx(&WindowRect, dwStyle, FALSE, dwExStyle);
static HWND Child_view_3D;
if(!
(hWnd=CreateWindowEx(dwExStyle,
"OpenGL",
Winname,
WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_BORDER|
dwStyle,
0,0,
WindowRect.right-WindowRect.left,
WindowRect.bottom-WindowRect.top,
NULL,
NULL,
hInstance,
NULL))
)
Das Child erstelle ich dazu in der WM_CREATE:
LRESULT CALLBACK WndProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam)
{
static HWND Child_top;
static HWND Child_view_3D;
static HWND Child_bottom;
static HWND Child_right;
static HWND Child_control;
static RECT rect;
static POINT Mausposition;
switch(message)
{
case WM_CREATE:
{
Child_top = CreateWindow( "static",
"",
WS_CHILD | WS_VISIBLE | WS_BORDER | WS_THICKFRAME | WS_EX_CLIENTEDGE | WS_CLIPSIBLINGS,
0, 0, 400, 400,
hWnd,
NULL,
((LPCREATESTRUCT) lParam) -> hInstance,
NULL);
Child_view_3D = CreateWindow( "static",
"",
WS_CHILD | WS_VISIBLE | WS_BORDER | WS_THICKFRAME,
401, 0, 400, 400,
hWnd,
NULL,
((LPCREATESTRUCT) lParam) -> hInstance,
NULL);
Child_bottom = CreateWindow( "static",
"",
WS_CHILD | WS_VISIBLE | WS_BORDER | WS_THICKFRAME,
0, 401, 400, 400,
hWnd,
NULL,
((LPCREATESTRUCT) lParam) -> hInstance,
NULL);
Child_right = CreateWindow( "static",
"",
WS_CHILD | WS_VISIBLE | WS_BORDER | WS_THICKFRAME,
401, 401, 400, 400,
hWnd,
NULL,
((LPCREATESTRUCT) lParam) -> hInstance,
NULL);
Child_right = CreateWindow( "static",
"",
WS_CHILD | WS_VISIBLE | WS_BORDER | WS_THICKFRAME,
801, 0, 400, 800,
hWnd,
NULL,
((LPCREATESTRUCT) lParam) -> hInstance,
NULL);
ShowWindow(Child_top,SW_SHOW);
SetFocus(Child_top);
SetForegroundWindow(Child_top);
ShowWindow(Child_view_3D,SW_SHOW);
SetFocus(Child_view_3D);
SetForegroundWindow(Child_view_3D);
ShowWindow(Child_bottom,SW_SHOW);
SetFocus(Child_bottom);
SetForegroundWindow(Child_bottom);
ShowWindow(Child_right,SW_SHOW);
SetFocus(Child_right);
SetForegroundWindow(Child_right);
Eine Fehlermeldung gibt er mir bei der registriereung der Klasse:
"1>Main.obj : error LNK2019: unresolved external symbol "long __stdcall Child_view(struct HWND__ *,unsigned int,unsigned int,long)" (?Child_view@@YGJPAUHWND__@@IIJ@Z) referenced in function "int __cdecl CreateGLWindow(char *,int,int,int,bool)" (?CreateGLWindow@@YAHPADHHH_N@Z)"
Kann mir einer sagen was da falsch ist?