Sign in to follow this  
kubapl

Dabbeling with win API

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
private:
	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

public:
	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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this