It worked me when I called from Jlink code. IT should work for C code also. Try adding sleep after function call.
I add "Sleep(5000)" after ProToolkitTaskExecute, but execute macro after finished code.
status = ProToolkitTaskExecute(real,"A",input_arguments,&output_arguments,&function_return); Sleep(5000);
When I was facing same issue in Jlink then I used this workaround of calling macro code from DLL and it worked for me.
If you have sometime than why don't you try same thing ?
Create Jlink application. On button click you load DLL and call macro method.
I can not handle Java.
So if you have to create an application for JLink to solve this problem, it will take a long time.
After all, C TOOLKIT can not run macros in the middle of code.
I had to search for another way.
Thank you for your help.
At the end of the mapkey call the button command again and manage your reentry by a static var or configure the button command.