Jump to content
  • Advertisement
Sign in to follow this  
The C modest god

No cursor

This topic is 5055 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!