No cursor

Started by
9 comments, last by Maega 19 years, 7 months ago
I have created a window:

    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?
It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower.Quote:Original post by Toolmaker Quote:Original post by The C modest godHow is my improoved signature?It sucks, just like you.
Advertisement
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
I tried putting hThisInstance instead of NULL, still doesnt work...
It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower.Quote:Original post by Toolmaker Quote:Original post by The C modest godHow is my improoved signature?It sucks, just like you.
I notice you break your own code in the second flags = line.

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
I need the HWND for createing directdraw.
It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower.Quote:Original post by Toolmaker Quote:Original post by The C modest godHow is my improoved signature?It sucks, just like you.
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?
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.
It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower.Quote:Original post by Toolmaker Quote:Original post by The C modest godHow is my improoved signature?It sucks, just like you.
It could be the fact DirectDraw is blitting over your cursor :X
No, there is no cursor even when I return DirectDraw's cooperative level and you can see the window box on the screen.
It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower.Quote:Original post by Toolmaker Quote:Original post by The C modest godHow is my improoved signature?It sucks, just like you.
I have found the problem.
I just did ShowCursor(FALSE) somewhere...
It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower.Quote:Original post by Toolmaker Quote:Original post by The C modest godHow is my improoved signature?It sucks, just like you.

This topic is closed to new replies.

Advertisement