Stop iteratively creating handle.

Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Sep 2007
Posts: 185
Reputation: eranga262154 is an unknown quantity at this point 
Solved Threads: 2
eranga262154's Avatar
eranga262154 eranga262154 is offline Offline
Junior Poster

Stop iteratively creating handle.

 
0
  #1
Jan 1st, 2008
Hi all,

I've create a window as follows,

  1. void CRtf::Initialize(void)
  2. {
  3. HWND m_hwnd_RTFBox = CreateWindowEx(
  4. WS_EX_APPWINDOW,
  5. RICHEDIT_CLASS,
  6. "RichTextWindow",
  7. WS_BORDER|ES_MULTILINE,
  8. 0,
  9. 0,
  10. 100,
  11. 100,
  12. ::GetConsoleWindow(),
  13. NULL,
  14. 0,
  15. NULL);
  16. }

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.

  1. while(m_hwnd_RTFBox != NULL)
  2. {
  3. // Do the processing here
  4. }

But it doesn't work. Can you guys give me a clue on this.
“victory breeds hatred, the defeated live in pain; happily the peaceful live giving up victory and defeat” - Gautama Buddha
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 185
Reputation: eranga262154 is an unknown quantity at this point 
Solved Threads: 2
eranga262154's Avatar
eranga262154 eranga262154 is offline Offline
Junior Poster

Re: Stop iteratively creating handle.

 
0
  #2
Jan 1st, 2008
Ok, I've solved the question my self. It's so easy. Do it in the constructor and destructor.
“victory breeds hatred, the defeated live in pain; happily the peaceful live giving up victory and defeat” - Gautama Buddha
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC