I am trying to make an opengl framework by first creating a window with DC then adding on from there. The window creates and closes fine, but when I move the cursor oven a border so that it changes to a resize cursor, then move the cursor into the window, it remains as the resize cursor. This isn’t really a problem - just an iritation. The following is the source code thus far. (only 100 lns) Please could someone load it into VC++ 6 and tell me whats wrong. Thanks:
#include <windows.h>
#include <stdio.h>
bool keys[256];
HDC hDC = NULL;
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevinstance, PSTR lpCmdLine, int iShowCmd)
{
HWND hWnd;
MSG Msg;
WNDCLASSEX wc = {0};
DWORD dwStyle = WS_OVERLAPPEDWINDOW;
DWORD dwExStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
//Initialize the Window
wc.cbSize = sizeof(wc);
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
wc.hCursor = LoadCursor(NULL, IDI_WINLOGO);
wc.hIcon = LoadIcon(NULL, IDC_ARROW);
wc.hIconSm = LoadIcon(NULL, IDI_WINLOGO);
wc.hInstance = hInstance;
wc.lpfnWndProc = WndProc;
wc.lpszClassName = "My Class";
wc.lpszMenuName = NULL;
wc.style = CS_VREDRAW | CS_HREDRAW | CS_OWNDC;
//Register Window with Windows
RegisterClassEx(&wc);
hWnd = CreateWindowEx (dwExStyle,
"My Class",
"Title Bar",
dwStyle | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
50,
50,
300,
300,
NULL,
NULL,
hInstance,
NULL);
hDC = GetDC(hWnd);
ShowWindow(hWnd, iShowCmd);
UpdateWindow(hWnd);
SetFocus(hWnd);
while(TRUE)
{
if(PeekMessage(&Msg,hWnd,0,0,PM_REMOVE))
{
if(Msg.message == WM_QUIT) break;
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
else
{
// Do all the hardcore computational stuff here [img]http://www.opengl.org/discussion_boards/ubb/smile.gif[/img]
}
}
ReleaseDC(hWnd,hDC); // Releases the memory of the HDC
DestroyWindow(hWnd);
UnregisterClass("My Class",hInstance);
return Msg.wParam; // And we're out
}
LRESULT CALLBACK WndProc (HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
switch(iMsg)
{
case WM_CREATE: break;
case WM_SIZE: break;
case WM_DESTROY: case WM_CLOSE: {PostQuitMessage(0); return 0;}
case WM_PAINT : break;
case WM_KEYDOWN: {keys[wParam] = true; return 0;}
case WM_KEYUP: {keys[wParam] = false; return 0;}
}
return DefWindowProc (hWnd, iMsg, wParam, lParam);
}