Results 1 to 2 of 2

Thread: CreateWindow Problems

  1. #1

    Thread Starter
    Addicted Member slashandburn's Avatar
    Join Date
    Aug 1999
    Location
    Marietta, Ga
    Posts
    229

    CreateWindow Problems

    Im trying to move a pocket pc game i made onto windows and my createwindow function is registering the class, but not making a window. What is wrong with this function.

    Code:
    bool SimpleWindow(LPCTSTR ClassName,LPCTSTR WindowName,HWND &WindowHwnd,HINSTANCE &hInstance)
    	{
    	WNDCLASS wc;
    
    	wc.style = 0;
    	wc.cbClsExtra=0;
    	wc.cbWndExtra=0;
    	wc.lpfnWndProc = MainWndProc;
    	wc.hInstance = hInstance;
    	wc.hbrBackground =(HBRUSH) (COLOR_WINDOW+1);
    	wc.hCursor=0;
    	wc.hIcon = 0;
    	wc.lpszMenuName = 0;	
    	wc.lpszClassName = ClassName;
    	
    	if(RegisterClass(&wc))
    		{
    
    		WindowHwnd = CreateWindow(ClassName,WindowName,WS_OVERLAPPEDWINDOW,0,0,320,320,NULL,NULL,hInstance,NULL);
    
    		if(WindowHwnd != 0)
    			{
    			return 1;
    			}
    		else
    			{
    			MessageBox(0,"Window Create Error","B",0);
    			return 0;
    			}
    		}
    	else
    		{
    		MessageBox(0,"Register Class Error","B",0);
    		return 0;
    		}
    	}

  2. #2

    Thread Starter
    Addicted Member slashandburn's Avatar
    Join Date
    Aug 1999
    Location
    Marietta, Ga
    Posts
    229
    Nevermind i resolved the problem. I didn't have a return in my WndProc.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width