John Hagen
June 19th, 1999, 02:02 PM
I was wondering if there is any way to pass a parameter, containing the name of a function that I want to call, and then call that function from within another function.
For instance:
void MyFunction()
{
...
MyTimer(MyFunctionToCall);
}
BOOL MyTimer(???? CallThisFunction)
{
...
CallThisFunction();
...
return TRUE;
}
I have a funtion that is a timer waiting on a message from an RS232 port. The timer is used to determine if a response was returned within a given period of time. The result is then passed back as a TRUE or FALSE.
What I want to do is this: Send a message to the RS232 port and then call the MyTimer function. If the timer function times out (no response from the RS232) I'd like to be able to resend the original message (CallThisFunction) and wait again.
My problem is I want the timer function to be a generic use function, and to embed 30 or 40 calls to specific RS232 messages, in the timer function, is not desirable. So by sending the RS232 a message, then calling the timer function and passing it the name of the function which it should call, should the message response fail, seems like an economical way to code. I just don't know what to use for the ???? in the MyTimer function or if it can be done.
I hope all of that makes sense, and I hope there is some way to do this.
Thanks in advance for your help.
John Hagen
For instance:
void MyFunction()
{
...
MyTimer(MyFunctionToCall);
}
BOOL MyTimer(???? CallThisFunction)
{
...
CallThisFunction();
...
return TRUE;
}
I have a funtion that is a timer waiting on a message from an RS232 port. The timer is used to determine if a response was returned within a given period of time. The result is then passed back as a TRUE or FALSE.
What I want to do is this: Send a message to the RS232 port and then call the MyTimer function. If the timer function times out (no response from the RS232) I'd like to be able to resend the original message (CallThisFunction) and wait again.
My problem is I want the timer function to be a generic use function, and to embed 30 or 40 calls to specific RS232 messages, in the timer function, is not desirable. So by sending the RS232 a message, then calling the timer function and passing it the name of the function which it should call, should the message response fail, seems like an economical way to code. I just don't know what to use for the ???? in the MyTimer function or if it can be done.
I hope all of that makes sense, and I hope there is some way to do this.
Thanks in advance for your help.
John Hagen