Trying to call the callback programmatically is really not the easiest approach. It would be much easier to just create a subfunction and call it from both locations. For example, if you callback code looks like:
switch (event)
{
case EVENT_COMMIT:
//Callback code
break;
}
return 0;
Then you would change that to:
switch (event)
{
case EVENT_COMMIT:
subFunctionName();
break;
}
return 0;
and write a new function:
subFunctionName()
{
//Callback code
}
Then, you can call subFunctionName() from the callback and anywhere else.
Calling the callback itself is not difficult though, but you have to fill in all the callback arguments and get the
function pointer which makes it more work. If you wanted to call the callback directly it would look something like this:
int (_cdecl *pt2Function) (int, int, int, void*, int, int);
GetCtrlAttribute (panelHandle, PANEL_GO, ATTR_CALLBACK_FUNCTION_POINTER, &pt2Function);
pt2Function(panelHandle, PANEL_GO, EVENT_COMMIT, NULL, 0, 0);
Where PANEL_GO is the control, and you want to execute the EVENT_COMMIT switch block of the callback.
Best Regards,
Chris Matthews
National Instruments