<?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 Re: User_terminate in Customization</title>
    <link>https://www.ptcusercommunity.com/t5/Customization/User-terminate/m-p/228958#M1334</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Calling user_initalize from within the application has a high risk to lead to infinite loops, memory overflows or other things like that. I'm not saying it won't work as I never tried but personally I'd avoid this at any cost.&lt;/P&gt;&lt;P&gt;In a situation similar with the one you described I think I'd take a somewhat opposite approach:&lt;/P&gt;&lt;P&gt;1. Make sure the users can't stop the application. For this you need to remove "ALLOW_STOP" and "DELAY_START" lines from the toolkit registry file.&lt;/P&gt;&lt;P&gt;2. Control when the commands defined by the application are available via the uiCmdAccessState functions. Let's say you define a command with the following line:&lt;/P&gt;&lt;PRE&gt;ProCmdActionAdd("NewCommand", (uiCmdCmdActFn)NewCmdFunction,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; uiProe2ndImmediate,AccessFunction, PRO_B_TRUE, PRO_B_TRUE, &amp;amp;cmd_id);&lt;/PRE&gt;&lt;P&gt;The "AccessFunction" argument is the uiCmdAccessState function. Here you can define the conditions if the new command is available or not.&lt;/P&gt;&lt;P&gt;For example you can make a certain function to be available only for drawings.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Take a look at the documentation and the sample application. There are some good example of access functions there.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 17 Jun 2016 16:37:50 GMT</pubDate>
    <dc:creator>GabrielZaha</dc:creator>
    <dc:date>2016-06-17T16:37:50Z</dc:date>
    <item>
      <title>User_terminate</title>
      <link>https://www.ptcusercommunity.com/t5/Customization/User-terminate/m-p/228955#M1331</link>
      <description>Hello,I am aware that user_terminate is the function where toolkit application scope ends. What I would like to do is that based on certain conditions I am planning to do in user_terminate, DLL scope sholud not be ended.Any suggestion would be much helpful.Let me know in case you</description>
      <pubDate>Sun, 13 Dec 2020 16:38:44 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Customization/User-terminate/m-p/228955#M1331</guid>
      <dc:creator>Ketan_Lalcheta</dc:creator>
      <dc:date>2020-12-13T16:38:44Z</dc:date>
    </item>
    <item>
      <title>Re: User_terminate</title>
      <link>https://www.ptcusercommunity.com/t5/Customization/User-terminate/m-p/228956#M1332</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If I understood correctly what you are trying to do is to prevent the toolkit application to stop unless certain conditions are meet. I'm afraid that is not possible.&lt;/P&gt;&lt;P&gt;"user_terminate" is a void function. That mean there is no specific return value when exiting the function. Simply said there is no way to make the difference if the exit condition is true or false.&lt;/P&gt;&lt;P&gt;Based on the information on the user guide; "user_terminate" is executed every time the applications end. It is a good place to do some "clean-up" like deleting user-defined menus, deleting temporary files, freeing up globally defined arrays and other thing of that nature.&lt;/P&gt;&lt;P&gt;The important note here is that the toolkit application will end no matter the actions defined in "user_terminate" and the outcome of those actions.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Jun 2016 13:01:12 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Customization/User-terminate/m-p/228956#M1332</guid>
      <dc:creator>GabrielZaha</dc:creator>
      <dc:date>2016-06-17T13:01:12Z</dc:date>
    </item>
    <item>
      <title>Re: User_terminate</title>
      <link>https://www.ptcusercommunity.com/t5/Customization/User-terminate/m-p/228957#M1333</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Correct... I would like Auxiliary application I.e. toolkit application still be available to user based on condition from user_terminate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Okay...seems it's not possible.. One thing I would try to check if I can still call user_initialize from user_terminate itself so that user gets feel of running application even if user_terminate is called.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any thought on this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and Regards&lt;/P&gt;&lt;P&gt;Ketan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Jun 2016 15:42:34 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Customization/User-terminate/m-p/228957#M1333</guid>
      <dc:creator>Ketan_Lalcheta</dc:creator>
      <dc:date>2016-06-17T15:42:34Z</dc:date>
    </item>
    <item>
      <title>Re: User_terminate</title>
      <link>https://www.ptcusercommunity.com/t5/Customization/User-terminate/m-p/228958#M1334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Calling user_initalize from within the application has a high risk to lead to infinite loops, memory overflows or other things like that. I'm not saying it won't work as I never tried but personally I'd avoid this at any cost.&lt;/P&gt;&lt;P&gt;In a situation similar with the one you described I think I'd take a somewhat opposite approach:&lt;/P&gt;&lt;P&gt;1. Make sure the users can't stop the application. For this you need to remove "ALLOW_STOP" and "DELAY_START" lines from the toolkit registry file.&lt;/P&gt;&lt;P&gt;2. Control when the commands defined by the application are available via the uiCmdAccessState functions. Let's say you define a command with the following line:&lt;/P&gt;&lt;PRE&gt;ProCmdActionAdd("NewCommand", (uiCmdCmdActFn)NewCmdFunction,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; uiProe2ndImmediate,AccessFunction, PRO_B_TRUE, PRO_B_TRUE, &amp;amp;cmd_id);&lt;/PRE&gt;&lt;P&gt;The "AccessFunction" argument is the uiCmdAccessState function. Here you can define the conditions if the new command is available or not.&lt;/P&gt;&lt;P&gt;For example you can make a certain function to be available only for drawings.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Take a look at the documentation and the sample application. There are some good example of access functions there.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Jun 2016 16:37:50 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Customization/User-terminate/m-p/228958#M1334</guid>
      <dc:creator>GabrielZaha</dc:creator>
      <dc:date>2016-06-17T16:37:50Z</dc:date>
    </item>
    <item>
      <title>Re: User_terminate</title>
      <link>https://www.ptcusercommunity.com/t5/Customization/User-terminate/m-p/228959#M1335</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Totally agree with what you suggested... But I have different pain area. I would like end user to start and stop application. Plus I do not want to provide or remove functionality from user_terminate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me tell you my thoughts if doing something on user_terminate. What additional thing I would like to do from application is to append application data(file name, user name etc) in a log file on shared location. Btthis data will get written when user stops application. Chances are there that other user is already stopped application and log file is in use. So, I want new user to ask him to stop for a while evenif user_terminate is called to write his log... I hope I have explained my pain area.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any thoughts would behelpful..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Jun 2016 18:12:01 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Customization/User-terminate/m-p/228959#M1335</guid>
      <dc:creator>Ketan_Lalcheta</dc:creator>
      <dc:date>2016-06-17T18:12:01Z</dc:date>
    </item>
    <item>
      <title>Re: User_terminate</title>
      <link>https://www.ptcusercommunity.com/t5/Customization/User-terminate/m-p/228960#M1336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think I understand now.&lt;/P&gt;&lt;P&gt;First the chances that two users are trying to write to the log file in the exact same time are really small.&lt;/P&gt;&lt;P&gt;In the situation that simultaneous writing do happen I'd try to create a delay for one of the users.&lt;/P&gt;&lt;P&gt;Try the following code:&lt;/P&gt;&lt;PRE&gt;void user_terminate()
{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ProUIMessageButton *buttons;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ProUIMessageButton user_choice;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Pro
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ProArrayAlloc (2, sizeof (ProUIMessageButton), 1, (ProArray*)&amp;amp;buttons);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;buttons[0] = PRO_UI_MESSAGE_RETRY;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;buttons[1] = PRO_UI_MESSAGE_IGNORE;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;do
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* log writing here */
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ProUIMessageDialogDisplay (PROUIMESSAGE_ERROR,L"Message Title",L"Some message!",buttons,PRO_UI_MESSAGE_OK,&amp;amp;user_choice);

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;while ( user_choice != PRO_UI_MESSAGE_IGNORE ) ;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ProArrayFree ((ProArray*)&amp;amp;buttons);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return;
}
&lt;/PRE&gt;&lt;P&gt;It is very crude but I hope you will get the ideea.&lt;/P&gt;&lt;P&gt;You will have to put log writing sequence inside the do - while loop and to set the correct exit condition.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Jun 2016 19:40:26 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Customization/User-terminate/m-p/228960#M1336</guid>
      <dc:creator>GabrielZaha</dc:creator>
      <dc:date>2016-06-17T19:40:26Z</dc:date>
    </item>
    <item>
      <title>Re: User_terminate</title>
      <link>https://www.ptcusercommunity.com/t5/Customization/User-terminate/m-p/228961#M1337</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Another possible solution would be the usage of a database, or a diff file if file get already worked that get joined on a later procedure.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jun 2016 11:37:26 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Customization/User-terminate/m-p/228961#M1337</guid>
      <dc:creator>Eike_Hauptmann</dc:creator>
      <dc:date>2016-06-20T11:37:26Z</dc:date>
    </item>
    <item>
      <title>Re: User_terminate</title>
      <link>https://www.ptcusercommunity.com/t5/Customization/User-terminate/m-p/228962#M1338</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ketan -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I may have misunderstood, but I think there is a simple solution to at least one of your problems.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;Ketan Lalcheta wrote:&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Totally agree with what you suggested... But I have different pain area. I would like end user to start and stop application. Plus I do not want to provide or remove functionality from user_terminate.&lt;/P&gt;

&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your registry (.dat) file, each application has an option called &lt;SPAN style="font-family: courier new,courier;"&gt;allow_stop&lt;/SPAN&gt; :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;If you set this to &lt;SPAN class="x-codeph-1-0"&gt;&lt;SPAN class="cf-Monospace-combined-European_Alphabets"&gt;TRUE&lt;/SPAN&gt;&lt;/SPAN&gt;, you can stop the application during the session. If this field is missing or is set to &lt;SPAN class="x-codeph-1-0"&gt;&lt;SPAN class="cf-Monospace-combined-European_Alphabets"&gt;FALSE&lt;/SPAN&gt;&lt;/SPAN&gt;, you cannot stop the application, regardless of how it was started. &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does setting &lt;SPAN style="font-family: courier new,courier;"&gt;allow_stop&lt;/SPAN&gt; to &lt;SPAN style="font-family: courier new,courier;"&gt;FALSE&lt;/SPAN&gt; resolve that problem for you?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I agree Gabriel that you shouldn't attempt to circumvent user_terminate. That function must execute correctly when the user quits Creo Parametric.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;|+|&amp;nbsp; M a r k&amp;nbsp; |+|&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jun 2016 16:58:33 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Customization/User-terminate/m-p/228962#M1338</guid>
      <dc:creator>MarkStallard</dc:creator>
      <dc:date>2016-06-22T16:58:33Z</dc:date>
    </item>
    <item>
      <title>Re: User_terminate</title>
      <link>https://www.ptcusercommunity.com/t5/Customization/User-terminate/m-p/228963#M1339</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once application is running into creo and if I go to .dat file and set allow_stop to false, would it result that user cannot stop application at all? Only option is to close creo session only?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Jun 2016 19:08:59 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Customization/User-terminate/m-p/228963#M1339</guid>
      <dc:creator>Ketan_Lalcheta</dc:creator>
      <dc:date>2016-06-23T19:08:59Z</dc:date>
    </item>
    <item>
      <title>Re: User_terminate</title>
      <link>https://www.ptcusercommunity.com/t5/Customization/User-terminate/m-p/228964#M1340</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ketan -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't remember ever setting &lt;SPAN style="font-family: courier new,courier;"&gt;allow_stop&lt;/SPAN&gt; to &lt;SPAN style="font-family: courier new,courier;"&gt;false&lt;/SPAN&gt;, but...&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;[...] would it result that user cannot stop application at all? Only option is to close creo session only?&lt;/P&gt;
&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your summary is correct, as far as I know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are two things you should be aware of:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Nobody is a perfect programmer. If your application somehow causes problems for your Creo users, then they have a good reason to stop the program. If you prevent them from stopping the program, it will cause harm to their employer and your reputation.&lt;/LI&gt;&lt;LI&gt;A determined and knowledgeable user could either edit the .dat file or copy it to run your program under a different name.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The best way to write these tools is to make them useful to your end users. It's much less helpful if you write code tries to "stop" them from doing their jobs creatively.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;|+|&amp;nbsp; M a r k&amp;nbsp; |+|&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Jun 2016 19:18:22 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Customization/User-terminate/m-p/228964#M1340</guid>
      <dc:creator>MarkStallard</dc:creator>
      <dc:date>2016-06-27T19:18:22Z</dc:date>
    </item>
    <item>
      <title>Re: User_terminate</title>
      <link>https://www.ptcusercommunity.com/t5/Customization/User-terminate/m-p/228965#M1341</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good points Mark. I totally agree.&lt;/P&gt;&lt;P&gt;The end user of my programs are most often my fellow coworkers. Some of them may use 2 or 3 different programs on a single day. Being able to start and stop the applications as they need make everyone's life more easier.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Jun 2016 19:36:07 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Customization/User-terminate/m-p/228965#M1341</guid>
      <dc:creator>GabrielZaha</dc:creator>
      <dc:date>2016-06-27T19:36:07Z</dc:date>
    </item>
  </channel>
</rss>

