About creating and hiding window in win32
-
I have created a win32 application, in which a window is created say mywindow1 and after that I am creating other window in the same application say mywindow2. Based upon some condition Mywindow2 is created, if the condition is not satisfied mywindow2 will not be created that is fine (no problem with this scenario). But when Mywindow2 is created it is not a child of mywindow1. While creating the mywindow2 I am using findwindow(null, “mywindow1”) method to get the handle and then using hidewindow(mywindow1hndl) mywindow1 is hided. Now my question is, finding a window handle using window name and hiding the window is a good idea or not in the real time application. Will this create a problem in the future? If not what is the best way to do it? Thanks, Nandu
-
I have created a win32 application, in which a window is created say mywindow1 and after that I am creating other window in the same application say mywindow2. Based upon some condition Mywindow2 is created, if the condition is not satisfied mywindow2 will not be created that is fine (no problem with this scenario). But when Mywindow2 is created it is not a child of mywindow1. While creating the mywindow2 I am using findwindow(null, “mywindow1”) method to get the handle and then using hidewindow(mywindow1hndl) mywindow1 is hided. Now my question is, finding a window handle using window name and hiding the window is a good idea or not in the real time application. Will this create a problem in the future? If not what is the best way to do it? Thanks, Nandu
How are you creating your window? Do you use the WS_CHILD value while creating it?
You need to google first, if you have "It's urgent please" mentioned in your question. ;-)_AnShUmAn_
-
How are you creating your window? Do you use the WS_CHILD value while creating it?
You need to google first, if you have "It's urgent please" mentioned in your question. ;-)_AnShUmAn_
-
I have created a win32 application, in which a window is created say mywindow1 and after that I am creating other window in the same application say mywindow2. Based upon some condition Mywindow2 is created, if the condition is not satisfied mywindow2 will not be created that is fine (no problem with this scenario). But when Mywindow2 is created it is not a child of mywindow1. While creating the mywindow2 I am using findwindow(null, “mywindow1”) method to get the handle and then using hidewindow(mywindow1hndl) mywindow1 is hided. Now my question is, finding a window handle using window name and hiding the window is a good idea or not in the real time application. Will this create a problem in the future? If not what is the best way to do it? Thanks, Nandu
Since you know when first window is alive or not (after all you create, destroy or hide the window...) why don't you set a global flag and use it? :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Since you know when first window is alive or not (after all you create, destroy or hide the window...) why don't you set a global flag and use it? :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
I have created a win32 application, in which a window is created say mywindow1 and after that I am creating other window in the same application say mywindow2. Based upon some condition Mywindow2 is created, if the condition is not satisfied mywindow2 will not be created that is fine (no problem with this scenario). But when Mywindow2 is created it is not a child of mywindow1. While creating the mywindow2 I am using findwindow(null, “mywindow1”) method to get the handle and then using hidewindow(mywindow1hndl) mywindow1 is hided. Now my question is, finding a window handle using window name and hiding the window is a good idea or not in the real time application. Will this create a problem in the future? If not what is the best way to do it? Thanks, Nandu
Nandu_77b wrote:
Now my question is, finding a window handle using window name and hiding the window is a good idea or not in the real time application. Will this create a problem in the future? If not what is the best way to do it?
Using
FindWindow()
could work or it could possibly result in a failure or a deadlock. WhatFindWindow()
does internally is callEnumWindows()
, and for each top-level window handle found, it sends aWM_GETTEXT
message to the window handle. Now if the thread that owns the handle is blocked (e.g., on a Semaphore, a Mutex, an Event, an I/O operation, or some other manner), theSendMessage()
call will block until that thread is freed up. Worst case, this may never happen soFindWindow()
will block forever."One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons