You can use the following code snippet to call a macro from C++ code.
Use ShellExecute API to launch Automation Anywhere.
To use this API <windows.h> has to be included.
ShellExecute(AppHandle,"open",(LPCTSTR)WMExePath,( LPCTSTR)pstrMessage,NULL,1);
AppHandle : This is the Handle of the calling Application window.
“open” : It is a Keyword which is used to open the EXE
WMExePath : The Path where Workspace Macro Exists.
Eg. WMExePath = “C:\Program Files\Workspace Macro 4.6\Workspace Macro.exe”
pstrMessage : The command line parameter to be passed with the Exe.
Eg. pstrMessage = “C:\\Document and Settings\\User\\My Documents\\Workspace Macro\\My Macros\\mymacro.wksp \\u”
Hope that helps. |