CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Welcome window

  1. #1
    Join Date
    Dec 2010
    Posts
    5

    Welcome window

    First of all, I want to excuse for my bad english

    I'm having c++ project @ university and I need some help. I'm working with Visual Studio 2008 Windows Forms. I made a web browser and now I need to make some kind of welcome screen leading to that browser or something like that. I should be something like a dialog window where is a text like "Welcome to my browser" and user pushes "OK" and then that browser loads. Of course if it's easier to make, it can be just simple welcome windows with "ok" button, and both windows (internet browser and dialog window) opens at same time but welcome windows should be in front.

    Anyone can help with code ?

  2. #2
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,675

    Re: Welcome window

    What you want apparently is a splash screen.

    To get one, simply define a form with any graphical elements on it you want, and no buttons. The form should contain a Timer object that you can add using the Forms Designer. You can also set up the timer's Interval (5000 ms, e.g.) and Enabled properties at design time. The form also needs a Tick event handler for the timer that simply should close the splash screen form.

    Note: As I interpret the MSDN documentation on the Forms::Timer class, the timer should also be stopped in the Tick event handler before closing the form or it wouldn't be subject to garbage collection. In case this is a misinterpretation and explicitly stopping the timer is not necessary, someone who knows better might correct me.

    Then, the main form's Load event handler should show the splash screen (modeless, using the splash screen form's Show() method). Further action is not required: The splash screen will close on its own when the timer expires.

    HTH
    Last edited by Eri523; December 18th, 2010 at 03:27 PM.
    I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.

    This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.

  3. #3
    Join Date
    Dec 2010
    Posts
    5

    Re: Welcome window

    Thanks, worked out fine

  4. #4
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,675

    Re: Welcome window

    An additional note I figured out in the meantime: If you set up the timer object as I described in post #2, the timer will start running as soon as the splash screen form object is constructed, which is before the splash screen actually is shown. If you want the time the splash screen stays open to be closer to the actual timer interval you've set up, you better leave the timer's Enabled property false at design time and instead start the timer in the splash screen form's Load event handler.

    It might not even make a notable difference to the user - I just wanted to mention it.
    I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.

    This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured