Thread: MFC function

  1. #1
    Registered User
    Join Date
    Feb 2004
    Posts
    42

    MFC function

    Code:
    int ga, gb; //global variable
    
    void CSortingDlg::Onbutton1() 
    {
    
    
    m_intA = ga;
    m_intB = gb;
    .
    .
    .
    
    }
    
    
    void CSortingDlg::Onbutton2() 
    {
    
    int a, b;
    
    a = ga;
    
    b = gb;
    
             if ( ( a == 0 ) || ( b == 0 ) )
            {
                   	MessageBox ( "Please enter a and b 1st.", "Error.", MB_ICONSTOP);
    .
    .
    .
    
    }
    Is there any way to jump back to function onbutton1() to read in a and b again before going down to onbutton2 function?
    Last edited by Eavan Hyde; 03-30-2004 at 02:04 AM.

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    pardon?

    OnButton1()


    or

    SendMessage() with a WM_COMMAND and BN_CLICKED
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  3. #3
    Registered User
    Join Date
    Feb 2004
    Posts
    42
    I use MFC, onbutton1 is the function of button1 and BN_CLICKED.

  4. #4
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Put all the code from Onbutton1() you need to use (when Onbutton2() is called) in ANOTHER member function.

    When Onbutton1() is called, call this member function.

    When Onbutton2() is called, call this member function then continue.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Change this program so it uses function??
    By stormfront in forum C Programming
    Replies: 8
    Last Post: 11-01-2005, 08:55 AM
  2. const at the end of a sub routine?
    By Kleid-0 in forum C++ Programming
    Replies: 14
    Last Post: 10-23-2005, 06:44 PM
  3. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 10:03 AM
  4. c++ linking problem for x11
    By kron in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2004, 10:18 AM
  5. I need help with passing pointers in function calls
    By vien_mti in forum C Programming
    Replies: 3
    Last Post: 04-24-2002, 10:00 AM