PDA

Click to See Complete Forum and Search --> : Window question


Technocrat
Feb 26th, 2001, 01:09 PM
How do I get another window in the same instance as my orginal but have its own control? When I try it, if I close the second window it ends the program. I dont want that. When I create another window away from the instance, it becomes modal and it will not let me interact with first window. Prob something simple I am sure.

parksie
Feb 26th, 2001, 01:41 PM
Have a separate window procedure for the second window, unless they're identical, in which case don't call PostQuitMessage unless all the windows have closed.

Technocrat
Feb 26th, 2001, 01:57 PM
Should it use the same class and instance? Or should I create a new one?

parksie
Feb 26th, 2001, 01:57 PM
Huh? Are you using MFC or some other framework method?

Either way I think a separate instance is better.

Technocrat
Feb 26th, 2001, 02:01 PM
No standard windows api. Sorry I realized asking about the class was stupid after I hit post. I meant the windows class you register, and the answer is no. But I will create a new instance and see if that works.

parksie
Feb 26th, 2001, 02:04 PM
You can use the same window class (I see what you mean now, sorry!). But you may need to find some way of differentiating between the two windows in the event handler -- try using SetWindowLong(..., GWL_USERDATA) and GetWindowLong to store identifiers.

Technocrat
Feb 26th, 2001, 02:29 PM
Ok I got it to work. Thanks for that SetWindow And GetWindow, I would not have tought of that. :)

parksie
Feb 26th, 2001, 03:06 PM
Neither did I...I first noticed it in Microsoft's COM samples in the platform SDK and thought "that's a good idea"...so I used it in my Window class.

Technocrat
Feb 26th, 2001, 03:09 PM
Got another question, how do you have a window that is not displayed in the title bar?

Technocrat
Feb 26th, 2001, 03:11 PM
I mean task bar. :( I need to get more sleep.

parksie
Feb 26th, 2001, 03:16 PM
It's gibbering something about Tool Windows in the help...

Okay -- the only reasonable thing I can find is:

1. Create a hidden window
2. Use that as the parent of your window

This will prevent a taskbar button...hopefully :D

Technocrat
Feb 26th, 2001, 03:31 PM
Yuck!!!!
There must be a better way.