Hi all,

I've create a window as follows,

void CRtf::Initialize(void)
{
	HWND	m_hwnd_RTFBox = CreateWindowEx(
							WS_EX_APPWINDOW,
							RICHEDIT_CLASS,
							"RichTextWindow",
							WS_BORDER|ES_MULTILINE,
							0,
							0,
							100,
							100,
							::GetConsoleWindow(),
							NULL,
							0,
							NULL);
}

After doing all the process, I've destroyed the window as well.

My question is this. I use the above handler iteratively within a loop. So all the time call the Initialize() in each processing step. Simply create and destroy to the equal number of looping process. I want to avoid it.

According to the MSDN, if the CreateWindowEx() is succeeds, the return value is a handle to the window. If it is failed the return value is NULL. So I've tried something like this.

while(m_hwnd_RTFBox != NULL)
{
// Do the processing here
}

But it doesn't work. Can you guys give me a clue on this.

Ok, I've solved the question my self. It's so easy. Do it in the constructor and destructor.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.