Skip to main content
10-Marble
January 22, 2024
Solved

How to use the pfsession class?

  • January 22, 2024
  • 1 reply
  • 1192 views

Hi

Recently I have been learning Creo Toolkit.

I have some doubts about using ProToolkit and Creo Object Toolkit 

The development environment is VS2019 and Creo 9. As a beginner, I started learning the Protoolkit and later learned the Object Toolkit. I referred to the example code of PTC and found that there are exceptions when using interfaces that both exist. The Pro toolkit interface works properly, but the object toolkit interface may cause program crashes. Debug information output "Invalid parameter passed to C runtime function."

For example, when selecting model items interactively, the ProSelect() function in the toolkit interface works properly, while the pfcSession:: Select() function crashes when the cancel button is clicked; When displaying messages, the Toolkit interface ProMessage Display() function can function properly, while the object Toolkit interface pfcSession:: UIDisplayMessage will crash. Similar situations occur in interface functions such as pfcSession:: UIOpenFile(), pfcSession:: UISelectDirectory(), and pfcSession:: UISaveFile().

I suspect that I missed something during the  initialization phase of the pfsession object.

If anyone knows where the problem is or has encountered a similar problem, please help me

Thanks

Best answer by YaroslavSin

pfcSession:: Select() can throw exceptions from user actions:

pfcXToolkitUserAbort  - The user chose Quit.

pfcXToolkitPickAbove  - Selection was interrupted by a user's pick on any button from above menus.

 

Need code sample, exceptions names to understand your other cases.

1 reply

17-Peridot
January 24, 2024

pfcSession:: Select() can throw exceptions from user actions:

pfcXToolkitUserAbort  - The user chose Quit.

pfcXToolkitPickAbove  - Selection was interrupted by a user's pick on any button from above menus.

 

Need code sample, exceptions names to understand your other cases.

wang666Tk10-MarbleAuthor
10-Marble
January 24, 2024

Thank you for your reply. I understand the problem. I did not handle any exceptions when using the object toolkit function