Thursday, February 14, 2008

Example ProTookit Application using Visual Studio 2005

PTC has been offering an Application Programming Interface (API) for Pro/Engineer for many years now and I have seen an article or two or three online that shows you how to develop Pro/Toolkit applications using Visual C++. These are very useful and if you navigate to the bottom of the page on article three then you will find a few zip files that you can download and start working with Visual C++ and Pro/Toolkit quickly. There is even a site that sells you tutorials on how to develop Pro/Toolkit applications. Of course I have never purchased any such tutorials so am unable to recommend them.

Interestingly very little outside help is available on developing Pro/Toolkit Applications using Visual C++. Simply Googling for Pro/Toolkit help is of very very little help. So what is a Pro/Toolkit developer to do?

In an effort to help other Pro/Toolkit developers who are using Visual C++ 2005 I have attached a zipped workspace created in Visual Studio 2005. This zipped workspace allows you to create a DLL that creates a Menu in the Pro/Engineer interface. Please use this workspace as a starting point - it is not by no means the perfect workspace (for example I currently put the menu.txt in two locations - which is not the most efficient way to do it). This workspace was created and donated by a colleague of mine, Amar Junankar (although I had created a similar workspace and have kept it updated for many years).

If you notice carefully in the workspace (after unzipping) in both the "debug" and "release" sub-folders there is a batch file named "Start_ProE_Here.bat". What this batch file does is start Pro/Engineer (default location of "C:\Program Files\proeWildfire 3.0\bin\proe.exe") from the "debug" or "release" (viz. current) sub-folder. This ensures that the protk.dat (which Pro/Engineer uses to register Pro/Toolkit applications) is loaded on startup of Pro/Engineer thus enabling our Pro/Toolkit application. Of course before starting this batch file, please do a build of both debug and release configurations.

As a side note: In my next post I will add to this workspace the necessary lines of code that will allow a developer to call .NET assemblies from within the Pro/Toolkit Application.

If you need any help please post a comment and I will try to help as much as I can.


  1. Thank you, it is really help me.

  2. Glad to hear it helps. Please do let me know what future posts or pro/toolkit help you need. I am always looking for topics to post on.

  3. Great work mate but would be more help if you could let know how do you set up the work space and also how to start and run a new Tool kit application

  4. Hi,

    Your article and application is really good for someone who is starting with protoolkit. Can you please also add some more information rearding building an asnynchronous application in VS 2005 ?

    Have you tried this before ? I face some linking errors for ptasyncmd.lib regarding standard library constructs strstream and ostrstream.



  5. Hey Vinay. Thanks for the comment.
    Regarding asynchronous Pro/TK application with VS 2005, I have not personally tried to do so recently. I have tried it in the past and was unable to proceed far (lack of resources and possibly skills). If you wish to post your linker errors perhaps I could take a look at them.

    I will try to post an article regarding asynchronous Pro/TK apps but I can't promise it will be soon as I would have to play with it and since I don't have a specific need for an asynchronous app currently.

    Might I know what you plan to use such an app for?

    What are you trying to accomplish with an asynch app that can't be accomplished with an synch app?

  6. Hi Ganeshram,

    Sorry for getting back late regarding this.

    I wanted to write an asynchronous utility 'dll' which can be called from an another application.

    Here the requirements are,
    1. Application should be able to start ProE session and get the process id for it. e.g. Use 'ProEngineerConnectionStart()'
    2. Application can connect to the proE process using 'ProEngineerConnect()'
    3. Do required tasks
    4. Disconnect using ProEngineerDisconnect()
    5. After completing 3-4 such batches, exit ProE

    For this requirement, I feel Asynchronous mode is best one. I still get the linker errors.

    Note : All my files are .c files but development environment is CPP in VS2005.

    Looking for your help.



  7. Hey Vinay,
    If I understood you right you want to run Pro/Engineer and perform a few batch mode operations. To be honest I have never successfully developed a Pro/Toolkit asynchronous app - lack of need and perhaps lack of skill.

    What I can suggest is one of the following:
    (1) Try using my Batch Mode Pro/E suggestion - - this is useful, in that you can develop synchronous Pro/TK apps and by simply tweaking the start-up directory for Pro/E you can run your Pro/TK app in batch mode.
    (2) Post your linker errors and I can try solving them for you.

  8. Hello sir,
    when i run this "start_ProE_Here.bat", I am getting a massage like "The system cannot find the path specified".