<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Macro Operations in a New Window in Customization</title>
    <link>https://www.ptcusercommunity.com/t5/Customization/Macro-Operations-in-a-New-Window/m-p/918938#M12731</link>
    <description>&lt;P&gt;Hello I'm trying to make the drawing model a new window of Creo now and use fast printing using macros.&lt;/P&gt;&lt;P&gt;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&lt;/P&gt;&lt;P&gt;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?&lt;/P&gt;&lt;P&gt;Sleep(); I tried a function to give delay, but there was a delay in the window as well as ProMacroExecute()&lt;/P&gt;&lt;P&gt;I'd appreciate it if you could tell me how. If there's any other cause than this, please help.&lt;/P&gt;&lt;P&gt;I am attaching the code I used below.&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;status = ProObjectwindowMdlnameCreate(name, (ProType)PRO_MDL_DRAWING, &amp;amp;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;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 18 Dec 2023 08:20:17 GMT</pubDate>
    <dc:creator>SP_10210577</dc:creator>
    <dc:date>2023-12-18T08:20:17Z</dc:date>
    <item>
      <title>Macro Operations in a New Window</title>
      <link>https://www.ptcusercommunity.com/t5/Customization/Macro-Operations-in-a-New-Window/m-p/918938#M12731</link>
      <description>&lt;P&gt;Hello I'm trying to make the drawing model a new window of Creo now and use fast printing using macros.&lt;/P&gt;&lt;P&gt;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&lt;/P&gt;&lt;P&gt;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?&lt;/P&gt;&lt;P&gt;Sleep(); I tried a function to give delay, but there was a delay in the window as well as ProMacroExecute()&lt;/P&gt;&lt;P&gt;I'd appreciate it if you could tell me how. If there's any other cause than this, please help.&lt;/P&gt;&lt;P&gt;I am attaching the code I used below.&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;status = ProObjectwindowMdlnameCreate(name, (ProType)PRO_MDL_DRAWING, &amp;amp;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;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2023 08:20:17 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Customization/Macro-Operations-in-a-New-Window/m-p/918938#M12731</guid>
      <dc:creator>SP_10210577</dc:creator>
      <dc:date>2023-12-18T08:20:17Z</dc:date>
    </item>
  </channel>
</rss>

