Archived

This topic is now archived and is closed to further replies.

Lambo429

Creating windows on the fly.

Recommended Posts

Lambo429    122
I have an html editor and i have the main window. I want to know how to make it so when i hit a toolbar button it opens a new window. Can i just make a new window out of no where? The button calls the function preview() and i want to know if i can make a new window in that function. I know it has to be a different class other wise when i close that window the main will close to. Any ideas?

Share this post


Link to post
Share on other sites
Oluseyi    2103
Creating new windows is trivial. Your real problem is that you have no clue how to manage them. Standard approach is for your main window (frame/parent) to maintain a list (or dynamically-resizing array) of child windows, to which new windows are appended and from which dead windows are removed. Because insertion and deletion are so much more important than iteration, a linked list is an appropriate container here.

That should get you started. If you still have no ideas, post back.

Share this post


Link to post
Share on other sites
You can create additional windows pretty much just like you created the main window. No offense, but I think you''re just making the issue more complicated than it needs to be. I''d suggest you just take a shot at it, and see what works and what doesn''t.

-Arek the Absolute

Share this post


Link to post
Share on other sites
Lambo429    122
Ok, youre right Arek, i made it harder than it was but now i have a question. I got it so it makes another window but its a copy of the window i already have. They share the same WndProc so when it calls WM_CREATE it just makes another one of the windows i have. How do i make it so this window is different? All i need is a popup syle window with a caption because it just previews the web page.
Lambo

Share this post


Link to post
Share on other sites
Lambo429    122
I just found something in another forum. Could i use SendMessage(WM_USER) instead of the WM_CREATE message? I need this because the windows are indentical which i dont want and when i close one the other closes to.

Share this post


Link to post
Share on other sites
Oluseyi    2103
If you want a "document window", you''ll need to define a separate WNDCLASS[EX]. If not, you can use one of the standard window classes. Select the appropriate window styles (sounds like you want WS_POPUP).

Share this post


Link to post
Share on other sites
Oluseyi    2103
quote:
Original post by Lambo429
Could i use SendMessage(WM_USER) instead of the WM_CREATE message?
Do you know what the WM_CREATE message handler does? It is orthogonal to your concerns.

I recommend that you acquire more of a grounding in how the Win32 GUI works.

Share this post


Link to post
Share on other sites
Lambo429    122
I did not ask for people to tell me what i know and dont know about win32 programming. I asked how i can create a different window from the first one since they are sending the same WM_CREATE message. DO i need to define a different wndproc?
Lambo

Share this post


Link to post
Share on other sites
mdias    823
quote:
Original post by Lambo429
DO i need to define a different wndproc?
Lambo


Yes, you should define a different wndproc since the window that you have is completely diferent from the window you want to create.

Share this post


Link to post
Share on other sites
Oluseyi    2103
quote:
Original post by Lambo429
I did not ask for people to tell me what i know and dont know about win32 programming. I asked how i can create a different window from the first one since they are sending the same WM_CREATE message. DO i need to define a different wndproc?
quote:
Original post by Oluseyi
If you want a "document window", you''ll need to define a separate WNDCLASS[EX]. If not, you can use one of the standard window classes. Select the appropriate window styles (sounds like you want WS_POPUP).
Before copping an attitude, you might want to learn to look at what you''ve already been given.

Share this post


Link to post
Share on other sites