Making a chat server. In Visual C++, how do I close an old window and open up a new one. (rather a new dialog). Whats the command?
Making a chat server. In Visual C++, how do I close an old window and open up a new one. (rather a new dialog). Whats the command?
Well, you don't *just* close and open windows with one command. First you have to set the fields of a WNDCLASS, then register the class. CreateWindow() will create the window, ShowWindow will show the window, and UpdateWindow will cause a WM_PAINT message to bypass the quaeu to paint to the client area.
--Garfield
I inserted a resource into my workspace. A dialog window and made a Cdialog child class with it in the class wizard.
Did this create the window? Or is there something else I need to do. Like add a member variable of the child class type to the Main Dialog class to create the window?
I tried DoModal. It didnt work, and I couldn't figure out ShowWindow. Is there anyway you could post a small example or send me a link? - Zedd
No, you have to create an instance of this class, and then call DoModal(). If you're not sure, look how the default wizard creates the code that will display the about box.Quote:
A dialog window and made a Cdialog child class with it in the class wizard.
Did this create the window?
GRRRRRRRRRRRR
I tried it repeatedly. And try doing the same thing they did in the About Dialog. It keeps telling me my CDialog Child Class made for that Dialog, CCHAT is an undeclared identifier when I edit the code on the button to connect.
Im getting really frustrated. I made a member function ( I guess it turned out to be a constructor) and I still can't get it to work. What gives? - Zedd
When you create a new class with the class wizard, it creates two new files - the .h and .cpp files. You'll have to include the header file for your new dialog class in the file that your creating an instance in. So make sure you've got "CHAT.h" included.
Instaed of closing the windows/dialogs just hide them with ShowWindow(hWnd,SW_HIDE) [SW_HIDE=0]
When you need them call tehm again with SW_SHOW [SW_SHOW=1].
This is one of the areas I find the standard API cleaner than MFC-- no class junk.
you use CreateWindow() and a handle to a window structure. You can dispose of the window easily by passing the handle of the created window to DisposeWindow(). You can hide/show the window easily with ShowWind().
Fast, easy to manage, effecient.
DisposeWindow()?
I have MSDevStudio 97/5, no DisposeWindow() in help, do you mean DestroyWindow()? Or has it been added to v6?