views:

41

answers:

1
+1  Q: 

vc++ forms window

i have created a form using visual c++. all im trying to do is this when a button is clicked the form is gone and new window will be showen. i don't know if i should repaint the window or there is another solution? please help Rami

+1  A: 

What I would do is display your game in the client area of the MainWindow of your app. In (possibly) Init_Instance() also call your form for the login. When the user has filled it in, just close that window and your game will already be behind it. You may need to refresh the screen afterwards so you don't get any artifacts.

Also, just noticed the "how to paint the whole thing" question.

myWindow.Invalidate(); http://msdn.microsoft.com/en-us/library/2dtwaxz7(VS.71).aspx

myWindow.InvalidateRect(LPCRECT lpRect, BOOL bErase = TRUE); http://msdn.microsoft.com/en-us/library/62w186xw(VS.71).aspx

Do not put it in the actual paint event, OnPaint().


I'm just answering the question.

Trap the button-click event, IOW, create a function for it and close the current window. Then call / create the new window in the same event / function. You'll most likely need a class level pointer to "hold" the current window.

No offense, but this would be a fairly bad design, unless you are making a "Wizard" type of construct. That is one window closing actually should bring up the next window.

JustBoo
is there way to just repaint the whole thing?
Ramiz Toma
im trying to create a game. when the user enters his name than the game will apper. so i used forms to get the user name and store it in file. than i want the game to show and the form to be gone. do you know any way to do that?
Ramiz Toma
See new verbiage above.
JustBoo
is there an easy way to create text box without using forms ?
Ramiz Toma
In raw Win32 there is and also MFC. If that is where you want to go then I *strongly* suggest getting a copy of Charles Petzold's "Programming Windows" http://www.charlespetzold.com/pw5/index.htmlIt's practically the "Bible" of Windows API.
JustBoo