Creating windows on the fly.
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?
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.
That should get you started. If you still have no ideas, post back.
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
-Arek the Absolute
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
Lambo
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.
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).
quote:Original post by Lambo429Do you know what the WM_CREATE message handler does? It is orthogonal to your concerns.
Could i use SendMessage(WM_USER) instead of the WM_CREATE message?
I recommend that you acquire more of a grounding in how the Win32 GUI works.
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
Lambo
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.
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 OluseyiBefore copping an attitude, you might want to learn to look at what you''ve already been given.
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).
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement