Hello I'm trying to make the drawing model a new window of Creo now and use fast printing using macros.
It works well if you run in a different environment (for example, an existing window rather than a new one), but when you create and run a new window using the ProObjectWindowMdlnameCreate() function, the ProMacroExecute(); function returns a PRO_TK_NOT_VALID error
I don't see the window at all, but I think it's because I'm trying to run the macro properly, is there a way to fix it?
Sleep(); I tried a function to give delay, but there was a delay in the window as well as ProMacroExecute()
I'd appreciate it if you could tell me how. If there's any other cause than this, please help.
I am attaching the code I used below.
Thank you.
status = ProObjectwindowMdlnameCreate(name, (ProType)PRO_MDL_DRAWING, &window_id);
status = ProMdlDisplay(mdl);
status = ProWindowCurrentSet(window_id);
status = ProWindowActivate(window_id);
wchar_t* mkMCRTopLevel1 = L"~ Command `ProCmdQuickPrint` 1;";
status = ProMacroLoad(mkMCRTopLevel1);
if (status == PRO_TK_NO_ERROR)
{
status = ProMacroExecute();
if (status != PRO_TK_NO_ERROR)
{
//This is where PRO_TK_NOT_VALID occurs.
return;
}
}
else
{
iMessageBox(L"ProMacroLoad error");
return;
}