Jump to content
  • Advertisement
Sign in to follow this  

Dabbeling with win API

This topic is 3636 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

So I'm building a directX game for my final project for my directx class and the other day I was trying to clean up my code a bit so I desided to write a wrapper class that handles creating my window and any other window api stuff for me so its not all in main. so to be brief this is inside my class
	DWORD		m_dwExstyle;		///< 
	LPCTSTR		m_lpClassName;		///< Name of the window class
	LPCTSTR		m_lpWindowName;		///< Title of the window
	DWORD		m_dwstyle;			///< Window style
	INT		m_nX;				///< X-Position of the window
	INT		m_nY;				///< Y-Position of the window
	INT		m_nWidth;			///< Width of the Window
	INT		m_nHeight;			///< Height of the window
	HWND		m_hWndParent;		///< Do we have a parant window?, NULL
	HMENU		m_hMenu;			///< Are we useing menus?, NULL
	HINSTANCE	m_hInstance;		///< Application handle
	LPVOID		m_lpParam;			///< Used with multiple windows, NULL

	CCreateWindow( HINSTANCE hInstance )
		m_dwExstyle		= NULL;		
		m_lpClassName	        = L"Class1";		
		m_lpWindowName	        = L"Main Window";		
		m_dwstyle		= WS_OVERLAPPEDWINDOW;			
		m_nX			= 300;				
		m_nY			= 300;				
		m_nWidth		= 500;			
		m_nHeight		= 400;			
		m_hMenu			= NULL;			
		m_hInstance		= hInstance;		
		m_lpParam		= NULL;	

And in my main I'm trying to create it like so:
CCreateWindow mainWindow( hInstance );
hWnd = mainWindow;

So the problem is I get a compile error:
1>c:\users\$$$\documents\visual studio 2008\projects\window\main.cpp(49) : error C2440: '=' : cannot convert from 'CCreateWindow' to 'HWND'
1>        No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called

So I'm guessing that I'm missing something any ideas?

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!