CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2010
    Posts
    13

    Moving Between Pages

    He im wondering on how to move between pages in a program.

    I mean if there was the program at startup and say you wanted to look at stocks, you would click on that button and it would take you to the stocks page, and if you wanted to go back you would click a back button.

    Would you have to hide all the controls using ShowWindow() and create a whole lot of new ones and vice versa for when the user clicks the other button?

    Cheers,

    RJK

  2. #2
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,234

    Re: Moving Between Pages

    What you are describing looks like a Property Sheet in wizard mode.
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  3. #3
    Join Date
    Apr 2010
    Posts
    13

    Re: Moving Between Pages

    Thanks for the information, also is it possible to load controls from another C++ file:

    e.g. I would want to load a button:

    Code:
    //Example
    
    void LoadButton()
    {
         HWND hButton = CreateWindow("BUTTON", "Click Me", WS_CHILD | WS_VISIBLE, 10, 10, 120, 27, hwnd, NULL, (HINSTANCE) GetWindowLong(hButton, GWL_HINSTANCE), NULL);
    
    }
    And here it would be used:

    Code:
    //Example
    
    #include "OtherFile.cpp"
    extern void LoadButton();
    
    .............
    
    WM_CREATE:
    {
        LoadButton();
    } break;
    The program executes but it does not load the button, do the controls code have to be implemented within the WM_CREATE case or can they be loaded form other sources like my example?

    Thanks,

    RJK

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Moving Between Pages

    Your "HWND hButton" is a local variable within void LoadButton() function. So it goes out of scope just as you return from LoadButton().
    Victor Nijegorodov

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