Function calls

This is a discussion on Function calls within the C++ Programming forums, part of the General Programming Boards category; Hi, say i call a function from within an event. Will the event carry on processing the code below the ...

  1. #1
    Registered User subdene's Avatar
    Join Date
    Jan 2002
    Posts
    359

    Function calls

    Hi, say i call a function from within an event. Will the event carry on processing the code below the function call? Or will it wait until the function returns to the caller, and the event will process the rest of the code? If the event does process code after the function not waiting for it to rerurn, is there any way of preventing this?
    Thanks for your help.
    Be a leader and not a follower.

  2. #2
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    One solution is to send a message to a worker thread that will do the processing. The "event" will continue after sending the message.

    SendNotifyMessage()

    Kuphryn

  3. #3
    Registered User subdene's Avatar
    Join Date
    Jan 2002
    Posts
    359
    so does the event still process code even if the function you have called hasn't returned?
    Be a leader and not a follower.

  4. #4
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    Correct. SendNotifyMessage() returns immediately. It does not wait.

    Kuphryn

  5. #5
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    wait wait wait.....

    you didn't mention threads.

    if you're saying something like this in the WndProc:
    Code:
    case WM_PAINT:
       HandlePaint(wParam, lParam);
       //do something else
       break;
    the "do something else" line is not executed until HandlePaint() returns. If you meant that handlepaint would be a thread then I apologize for intruding.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Accurately detecting function calls
    By Mole42 in forum C Programming
    Replies: 5
    Last Post: 05-17-2009, 04:01 AM
  2. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  3. <Gulp>
    By kryptkat in forum Windows Programming
    Replies: 7
    Last Post: 01-14-2006, 12:03 PM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  5. C++ compilation issues
    By Rupan in forum C++ Programming
    Replies: 1
    Last Post: 08-22-2005, 05:45 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21