WNDCLASS wc;
DWORD flags;
if (hPrevInstance == NULL)
{
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = sizeof(DWORD);
wc.hInstance = hThisInstance;
wc.hIcon = NULL;//LoadIcon(hThisInstance, MAKEINTRESOURCE(IDI_ICON1));
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
wc.lpszMenuName = NULL;
wc.lpszClassName = "ENVIRO";
if (!RegisterClass(&wc))
return FALSE;
}
flags = WS_POPUP | WS_VISIBLE | WS_EX_TOPMOST | WS_SYSMENU;
flags = /*WS_POPUP | WS_MAXIMIZE |*/ WS_EX_TOPMOST | WS_VISIBLE;
/* if (bResizingDisabled)
flags = WS_VISIBLE | WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU |
WS_MINIMIZEBOX | WS_MAXIMIZEBOX;
else
flags = WS_OVERLAPPEDWINDOW;*/
*lpHWnd =
CreateWindow
( "ENVIRO", // Class
"PompiPmopi(tm)", // Title bar
flags,
CW_USEDEFAULT, // Init. x pos
CW_USEDEFAULT, // Init. y pos
400, // Init. x size
400, // Init. y size
NULL, // Parent window
NULL, // Menu handle
hThisInstance, // Program handle
NULL // Create parms
);
if (!*lpHWnd)
return FALSE;
gHInstance = hThisInstance;
gHWnd = *lpHWnd;
However, whenever I move the cursor on the window the cursor icon dissappears.
Why is that? and how can I make the cursor visible in my window?
No cursor
I have created a window:
I haven't tried myself, but I belive the line
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
might be the problem. According to Microsoft:
HCURSOR LoadCursor(HINSTANCE hInstance,
LPCTSTR lpCursorName);
hInstance
[in] Handle to an instance of the module whose executable file contains the cursor to be loaded.
I personally don't think NULL is a valid choise, but the again I haven't tried it.
Johan
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
might be the problem. According to Microsoft:
HCURSOR LoadCursor(HINSTANCE hInstance,
LPCTSTR lpCursorName);
hInstance
[in] Handle to an instance of the module whose executable file contains the cursor to be loaded.
I personally don't think NULL is a valid choise, but the again I haven't tried it.
Johan
I notice you break your own code in the second flags = line.
And why are you using a HWND *? Just curious
WNDCLASS wc; DWORD flags; if (hPrevInstance == NULL) { wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = WndProc; wc.cbClsExtra = 0; wc.cbWndExtra = sizeof(DWORD); wc.hInstance = hThisInstance; wc.hIcon = NULL;//LoadIcon(hThisInstance, MAKEINTRESOURCE(IDI_ICON1)); wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); wc.lpszMenuName = NULL; wc.lpszClassName = "ENVIRO"; if (!RegisterClass(&wc)) return FALSE; } flags = WS_POPUP | WS_VISIBLE | WS_EX_TOPMOST | WS_SYSMENU; flags = /*WS_POPUP | WS_MAXIMIZE |*/ WS_EX_TOPMOST | WS_VISIBLE; //<--here. You define flags with WS_POPUP and WS_SYSMENU, but then kill that off with the second line. Why?/* if (bResizingDisabled) flags = WS_VISIBLE | WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX; else flags = WS_OVERLAPPEDWINDOW;*/ *lpHWnd = CreateWindow ( "ENVIRO", // Class "PompiPmopi(tm)", // Title bar flags, CW_USEDEFAULT, // Init. x pos CW_USEDEFAULT, // Init. y pos 400, // Init. x size 400, // Init. y size NULL, // Parent window NULL, // Menu handle hThisInstance, // Program handle NULL // Create parms ); if (!*lpHWnd) return FALSE; gHInstance = hThisInstance; gHWnd = *lpHWnd;
And why are you using a HWND *? Just curious
You can pass a normal HWND to DirectDraw. I don't see the reason why you're using a HWND pointer :).
Have you fixed your problem yet?
Have you fixed your problem yet?
No, I dont know why there is no cursor in my window.
The mouse works, I can click it in the window and it will have effect, but I just dont see the mouse's cursor.
The mouse works, I can click it in the window and it will have effect, but I just dont see the mouse's cursor.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement