|
-
Sep 6th, 2002, 02:48 PM
#1
Thread Starter
Junior Member
Pausing a function
You know, if you create a message box by AfxMessageBox(...)
function, you might aware of that, the function do not return until user clicks the appropriate button e.g. Cancel, OK, Yes, No... etc.
It seems the function waits until user presses a button instead of returning a value. A function completes execution usually in a few miliseconds. But its unusual for a function to wait for an unlimited time.
I have thought about it, but got no idea on how to do that.
Would you please share, if you have any idea.
-
Sep 6th, 2002, 03:13 PM
#2
Frenzied Member
psudocode:
function
{
show messagebox
if(yes)
return yes;
else if(no)
return no;
}
-
Sep 8th, 2002, 02:35 PM
#3
Fanatic Member
int main()
{
short paused;
//set it to be paused
paused=1;
while(paused==1)
code;
code;
code;
code;
//make sure u can unpause it
paused=0;
loop;
}
-
Sep 9th, 2002, 05:41 AM
#4
Sleep(time);
or the Wait* family
WaitForSingleObject(hEvent);
will wait until another thread fires the event referenced by hEvent.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Sep 11th, 2002, 09:09 AM
#5
Thread Starter
Junior Member
Thank you very much SteveCRM, Mushroom Realm and CornedBee.
The thing I want to do is to avoid a function from returning a value untill the user clicks on the defined coordinates. I think CornedBee`s reply is the solution of my problem.
Would you please give some details on how to adaptate WaitForSingleObject(...) function to my code.
Again, thank you all for your replies.
-
Sep 11th, 2002, 09:30 AM
#6
Show me your code and I'll tell you how to implement it.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Sep 11th, 2002, 01:11 PM
#7
Thread Starter
Junior Member
I don`t know how to write write that code, exactly. But when the function is called, it handles mouse-down messages and checks if the mouse-down point is in the specified area; if it is, the function returns true, if not, it continues handling messages and checking if the expression is true.
My limited knowledge in C++ doesn`t seem to be enough to code that function, but I need it very badly, to complete my project.
Would you please help.
Thanks in advance.
-
Sep 12th, 2002, 03:33 AM
#8
I don't think I really understand what you're trying to do, since the way I interpret your explanation it would be a completly senseless thing to do.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|