Code:
class Window;
class ComboBox;


 	class Window
{
	public:
		void Show();
		void Hide();
		void SetFont(HFONT NewFont);
		HWND GethWnd();
	protected:
		HWND itshWnd;
};
	
	HWND Window::GethWnd()
	{
		return itshWnd;
	}


	void Window::Show()
	{
		ShowWindow(itshWnd, SW_NORMAL);
	}
	
	void Window::Hide()
	{
		ShowWindow(itshWnd, SW_HIDE);
	}

	void Window::SetFont(HFONT NewFont)
	{
		SendMessage(itshWnd, WM_SETFONT, (WPARAM) NewFont, (LPARAM) true);
	}

	
	
	class ComboBox: public Window
{
	public:
		//constructors
		ComboBox(RECT area, HWND OwnerhWnd, HINSTANCE hStance);
		  //ComboBox(RECT area, HWND OwnerhWnd);
		~ComboBox();
		void AddItem(char *NewItem);
		int GetItem();
	protected:
		HWND Owner;
		HINSTANCE hIns;
};

	
	ComboBox::ComboBox(RECT area, HWND OwnerhWnd, HINSTANCE hStance)
	{
		Owner = OwnerhWnd;
		//hIns = hStance;
		itshWnd = CreateWindowEx(WS_EX_CLIENTEDGE, "ComboBox", "", WS_CHILD | CBS_DROPDOWNLIST , area.left, area.top, area.right - area.left, area.bottom - area.top, Owner, 0, hStance, NULL);
	}

/*	ComboBox::ComboBox(RECT area, HWND OwnerhWnd)
	{
		//Assumes that a different Combo (with HINSTANCE) has been created
		Owner = OwnerhWnd;
		itshWnd = CreateWindowEx(WS_EX_CLIENTEDGE, "ComboBox", "", WS_CHILD | CBS_DROPDOWNLIST , area.left, area.top, area.right - area.left, area.bottom - area.top, Owner, 0, hIns, NULL);
	} */

	ComboBox::~ComboBox()
	{
		//Nothing
	}

	void ComboBox::AddItem(char *NewItem)
	{
		SendMessage(itshWnd, CB_ADDSTRING, 0, (WPARAM) NewItem);
	}

	int ComboBox::GetItem()
	{
		return (int) SendMessage(itshWnd, CB_GETCURSEL, 0, 0);
	}
In case you hadn't noticed I'm trying to make my own sort of class for each control, starting with comboboxes.

Now, what I want to do is to be able to access the class
from any part of code module. But if I make a global variable:

Code:
ComboBox cmbOper(WndRect, hWnd, hInst);
It obviously fails miserably because hInst, hWnd and WndRect haven't been created yet.

I tried something to do with the free store, but I couldn't access it outside of the procedure where I created it because the actual memory still existed, but the name I had given it was not declared in the routine I was trying to call it from, and that me... Arrrrgh.

Plain and simple:

How do I create an object that I can access anywhere in my code given that it has its own constructor?

There's got to be a way...