Wednesday, March 26, 2008

HOWTO: Example Pro/Toolkit Application using Visual Studio 2005

In my previous post titled "Example ProTookit Application using Visual Studio 2005" I received a comment asking to explain how I created the sample workspace (Pro/Toolkit Application using Visual C++ 2005) which can be downloaded by clicking the file below:

I should point out that the workspace that is attached above, while it is currently in Visual Studio 2005 format, came initially from Visual Studio 2002 (or known as Visual Studio.NET) and my colleagues and I regularly updated the workspace in current versions of Visual Studio.

In this post I try and explain the steps I used to create a sample workspace from scratch in Visual Studio 2005 for Pro/Toolkit applications. For more details (although with some mistakes some of which I will list in future posts) refer to "tkuse.pdf" in "C:\Program Files\proeWildfire 3.0\protoolkit".

I break the process down into following steps:

Creating the Visual Studio 2005 solution

The easiest method I know of to create a Pro/Toolkit Application in Visual Studio 2005 (that matches the above workspace) is to start with an Empty Project. Name it "proe" for example.

Add a file named "main.cpp".

Add the following code to "main.cpp"

#include <windows.h>

#include <protoolkit.h>
#include <procore.h>

/** Make sure to call ProToolkitMain passing the arguments passed into main
extern "C" int main(int argc, char **argv)
ProToolkitMain(argc, argv);
return 0;

/** Required entry point for Pro/Toolkit
extern "C" int user_initialize()
MessageBox(NULL, "Pro/Toolkit App", "proe", MB_OK);
return 0;

extern "C" void user_terminate()
Change the "Configuration Type" to "Dynamic Library (.dll)".

Add the relevant include folders for Pro/Toolkit ("C:\Program Files\proeWildfire 3.0\protoolkit\includes";"C:\Program Files\proeWildfire 3.0\prodevelop\includes").

Add the following pre-processor definitions (WIN32;NDEBUG;_WINDOWS;_USRDLL;PROE_PROJ_EXPORTS;PRO_MACHINE=29; PRO_OS=4;hypot=_hypot;MSB_LEFT;far=ptc_far;huge=p_huge;near=p_near;_X86_=1)

Make sure for the Runtime Library you are using "Multi-threaded DLL (/MD)" or the "Multi-threaded Debug DLL (/MDd)" based on whether you are using "Release" or "Debug" configuration respectively.

Make sure that the "Treat wchar_t as Built-in Type" is set to "No (/Zc:wchar_t-)".

Add the relevant Pro/Toolkit and Pro/Develop library folders ("C:\Program Files\proeWildfire 3.0\prodevelop\i486_nt\obj";"C:\Program Files\proeWildfire 3.0\protoolkit\i486_nt\obj").

Add the "Additional Dependencies" (wsock32.lib mpr.lib prodev_dllmd.lib protk_dllmd.lib psapi.lib)

Do a Rebuild and make sure you have a DLL named "proe.dll" in a sub-folder named Debug or Release depending on your build configuration.

Creating the Pro/Toolkit application files and message files

Pro/Engineer loads Pro/Toolkit applications using a registration file named "protk.dat" in the Debug AND Release folder. You need to create a protk.dat file for the Pro/Toolkit DLL that you created using the workspace above. While developing and testing the Pro/Toolkit application I use the following "protk.dat":
NAME proe
EXEC_FILE proe1.dll
TEXT_DIR ..\text
allow_stop TRUE
revision Wildfire

The "protk.dat" is pretty easy to understand although it would have helped if Pro/Engineer used a more standard method such as the Windows Registry (although that may not work since Pro/Engineer is multi-platform). The main variables you need to be aware of are:
  • TEXT_DIR - The value for this variable is "..\text". This means you need to create a sub-folder named "text" under your main folder. In the "text" folder create a text file named "menu.txt". The "text" folder and the text file "menu.txt" (the name can be changed but I don't delve into that in this post) are Pro/Engineer's bizarre method to enable localization. The "menu.txt" file looks something like the following:
USER %0s
It simply lists the label that is seen by the Pro/Toolkit application and its corresponding value. Most Visual C++ developers use either a String Table or other sort of Resource. If you think this is weird, I think it may have something to do with Pro/Engineer supporting multiple Operating Systems.
  • STARTUP - For the example provided the type is "DLL".
Execute Pro/Engineer and load the Pro/Toolkit Application

While developing and testing your Pro/Toolkit application I use the following method:
  • Create a shortcut to "C:\Program Files\proeWildfire 3.0\bin\proe.exe" in your Pro/Toolkit's "Debug" or "Release" folder.
  • Make sure the "Start in" text box for this shortcut remains empty which means that this shortcut will start Pro/Engineer in the current folder and will automatically load the DLL specified in protk.dat located in the same folder.
  • Double click the shortcut you created to run Pro/Engineer. If you get a message box with the text "Pro/Toolkit App" then IT WORKED. REJOICE.

If the method in the above post did not work for you, you can also download the ZIP file I have provided and try that out. If you need more help, post a comment and I will try to provide more information.


  1. I created a workspace as you told us step by step, but when I builded it,a command line error appeared: missing source filename.
    Could you explain it for me ?
    Thanks a lot !

  2. I did a quick search for the error that you received and found this:
    It seems to indicate that the "mail.cpp" file that you need to add per my instructions is not being picked up by Visual Studio 2005 compiler. See if it got added properly. As an alternate download the zip file I have posted to use as a starting point.

  3. Sorry, my previous comment should have read "main.cpp" not "mail.cpp". Please ensure that "main.cpp" is added properly to the Visual Studio 2005 solution.

  4. Thanks for your help, Ganeshram Iyer.
    I have found where the proble is.
    There is something strange(not wrong)with the content of pre-processor definitions: when I copy the content and paste it into Visual Studio 2005, there will be a ' " 'before the content(I still can't understand).If I delete the '" ',the workspace will be builded successfully.

    I an a chinese engineer. Would you mind knowing a chinese friend?
    You can write to my

  5. Glad to hear that it went well. If it would not be too much trouble, I would love to know what you use the Pro/Toolkit application for and if and how my tutorial helped.

  6. The company that I have worked for uses AutoCAD as the platform. I want to replace the platform with Pro/Engineer, but there is something different between the ISO standard and our national standard. So we need to customise it.
    I have been looking for the tutorial for a long time. Even I have found some websites but they are not what I need. Because I use Visual Studio 2005 and Pro/E Wildfire 4.0. Their tutorials discrible the settings in old versions and very simply, even it doesn't go well.

  7. Thanks again for posting. I hope you are I tried to email you but the email bounced back.

    If you found this tutorial helpful do let me know if I can post other Pro/Toolkit-related contents.

  8. I am sorry that I have put a chinese domain behind my E-Mail address.
    You can try the following again:

    Do you have any tutorials about using the MFC dialogue to exchange datas with Pro/E for developping Pro/Toolkit application?
    Thanks again!

  9. Thanks for the comment. As far as a MFC dialog tutorial for Pro/Toolkit App - I don't have a tutorial but do have a full fledged app at the company I work with that I can strip to create one. But I must say that working with MFC dialogs and Pro/Toolkit is nothing special. It is a regular MFC dialog app (possibly in a DLL) that can be loaded into the Pro/Toolkit app. Is there any special aspect of the MFC+Pro/Toolkit app that you are looking for help on? I could generate a tutorial for simply that aspect then.

  10. I am interested in finding a developer to develope a screen room drawing app for me to use on my web site, I would like to talk with a developer or two on this

  11. Hello Jim, Glad to know you found my blog. I would like to hear your requirements on the "screen drawing app". Post a comment or you could even email me at ganeshramiyer at gmail dot com.

  12. Thank you for every think. Its so usefull.

    Mustafa TURGUT, TURKEY

  13. Hi Mustafa,
    Thanks for comment but please do let me know more - what articles do you want to read in the future on my blog?

  14. Hi,
    I ma very new to Pro/Toolkit. I have done some automation work using the relations and parameters in Pro-E. Now i want to learn Toolkit, please let me know what are the system environmental variables should i set?

  15. Hello Anonymous,
    To be honest I don't quite understand your question. If you are asking if I set any environment variables on my Windows PC then the answer is "I did not set any env var".

    But when I do see my env var dialog box I see only the following under "User variables for %USERNAME%"
    Variable name: PRO_COMM_MSG_EXE
    Variable value: "C:\Program Files\proeWildfire 3.0\i486_nt\obj\pro_comm_msg.exe"

    though I am not sure if this is something you even need to set. If you tried to work with the article/downloadable workspace I have provided and it did not work, then I can try to help more. Post a comment with specific questions which I can answer.

  16. Hi!
    Nice blog,
    im new to toolkit and tried to build your project on vs 2008 express.
    When i try to run the dll on wf2 win64 i got the message:
    The Pro/TOOLKIT application "ProE_Proj" was not unlocked before distribution to your site.
    se Pleasec ontact the provider of "ProE_Proj" for assistance.

    What is wrong? can you help?THX

  17. Hi Hans,
    Thanks for the comment. I guess I should post a quick article on the fact that I am delivering projects purely for developers. I don't pay for a personal license of Pro/Engineer + Pro/Toolkit. That means that anyone who wants to load my Pro/Toolkit application in their Pro/E NEEDS to have an active Pro/Toolkit License.

    So the error you have indicates that you do not have a Pro/Toolkit license. Sorry about that.

  18. Hi,
    i make the example project, but i receive the linker error:
    main.obj : error LNK2019: unresolved external symbol _ProToolkitMain referenced in function _main

    I used a x64 pc.


  19. Thanks CattoCrociato for your comment. Unfortunately I do not have access to an x64 PC to test what happens on that platform with my workspace. There are numerous things I am unaware of viz. how well is Pro/Toolkit supported on x64? are there any nomenclature/functional differences between various API? etc.

    If you do find a solution, I would appreciate it if you could post it with your next comments, so readers would be able to use it.

  20. Dear Ganeshram Iyer,

    First thanks for your very accurate toolkit "tutorials". Owing to your help I have succesfully finished an add-on for our company. Now we want to do a repetative operation on numerous files with pro toolkit and Distributed ProBatch. I followed the toolkit guide instructions for task based library but dbatch fails to load the dll fuction. Do you have experience? How should the dbatchs.dat file look like?
    Thanks again!

  21. Ganeshram Iyer
    thanks so much!
    the tutoriol help me in my study!

  22. Thanks for the comment Hankster,
    I must apologize as I have no experience with ProBatch. I use an alternate technique to run Pro/E in batch mode - detailed here:

    This may not suit your needs but unfortunately I may not be more help.

  23. Thanks whatit for the comment. Glad to be of assistance.

  24. This comment has been removed by the author.

  25. Thanks Sandip Jadhav for your comment. Let me know if there are any topics you would like to read about.

  26. hi,

    I am compiling pro/toolkit application code for Wildfire4.0 in visual studio2005.I use the makefiles for compiling the code. But I do get some errors (Linking errors)
    somehow I tried with new visual studio set up and got the DLL but that DLL is not working .

    So I am trying with the make file concept(provided by PTC ), because I suppose that the set up done by me may not be correct.They have done some set up there for Visual Studio 2005.

    But I solved most fo the errors and still I have some errors to fix it now.

    could anyone help on this?

    (I believe in this makefile concept , because I got a DLL and it works fine- without any errors).

    Error 215 error LNK2019: unresolved external symbol _user_terminate referenced in function _user_terminate_plus
    Error 216 fatal error LNK1120: 1 unresolved externals
    Error 217 fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 8\VC\bin\link.EXE"' : return code '0x460'
    Error 218 error PRJ0019: A tool returned an error code from "Performing Makefile project actions"

    I thank you all guys who helped me before for their valuable help.

  27. Hey selva,
    Thanks for the comment. Did you download the zip file I have posted with this blog and at

    I believe this should work for Pro/E WF 4.0 too. I have not tested that yet but will do so in a few days as I plan to upgrade to Pro/E WF 4.0. If I notice any differences, I will post a new version on my blog. Keep following my blog for any updates.

    If you have a license issue then my colleague at has posted a solution.

  28. Hello,
    I tried with same settings for WF 5.0 but got failures while building can you provide changes needs to be done for protoolkit project setting for WF 5.0 in VS 2008

  29. Hi Rahul,
    Thanks for your comment. Unfortunately I do not have (yet) access to Pro/E WF 5.0 or VS 2008. I am still working with Pro/E WF 4.0 and VS 2005. Upgrading either is not planned in the near term. Perhaps you could post the 'build failures' and I could try to duplicate some of it in my environment. If you prefer to email me, you could do so at ganeshramiyer at gmail dot com.

  30. Thanks !! it is really helpful Ganeshram.

  31. Hello Ganeshram Iyer. I'm german and have wildfire 5.0 and Visual Studio 2010.

    And this error is my problem:

    1> main.cpp
    1>main.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_ProToolkitMain" in Funktion "_main".
    1>C:\Users\Silvanus\documents\visual studio 2010\Projects\proe\Debug\proe.dll : fatal error LNK1120: 1 nicht aufgelöste externe Verweise.

    And in the Pro/TOOLKIT® User’s Guide is written:

    "In DLL mode, you cannot do this because you do
    not have access to the Pro/ENGINEER main()"

    What can I do?

  32. Hello schandmaul_16. Thanks for your comment. I only have Pro/E WF4.0 with Visual Studio 2005 but I do call ProToolkitMain() in my DLL's main(). It is true that a DLL does not have a true "main()" but at least till the version I have tested with (i.e. WF4.0) it has not mattered. Are you linking with the right Pro/Toolkit libraries? These are the ones I use: prodev_dllmd.lib protk_dllmd.lib.

    If you need more help or want to take the conversation to email, you can contact me at ganeshramiyer at gmail dot com.

  33. Moybe do you now how set up project when used Pro/Toolkit from Pro/Engineer Wildfire 5, and Microsoft Visual Studio 2008? This is solution does not work on this version.

    P.S. Sorry for my english, i'm speek on russian language. :)

  34. Hello Anonymous - I wish you had left a name or contact information to reply to you. I don't have VS2008, but am working with my colleague to port the Pro/Toolkit application to VS2010. It seems to work fine with some slight modification. If you could post your errors I can try to help as much as I can.

  35. Hello Ganeshram Iyer! I receive 287 errors at link my project. Errors look approximately so:

    Error 2 error LNK2005: _wc32towc16 already defined in prodevelop.lib (ctwcfun.obj) protoolkit.lib

    I want to create asynchronous application. I can install VS2010, no problems. Could you send your setting of the compiler for asynchronous application. It is possible directly on my mail, or post here. In advance I thank you.

  36. My compiler setting:
    Additional Include Directories:
    Debug information Format:
    Program Database for Edit & Continue (/ZI)
    Warning Level:
    Level 3 (/W3)
    Detect 64-bit Portability Issues:
    Yes (/Wp64)
    Disabled (/Od)
    Preprocessor Definitions:
    Enable Minimal Rebuild:
    Yes (/Gm)
    Basic Runtime Checks:
    Both (/RTC1, equiv. to /RTCsu)
    Runtime Library:
    Multi-threaded Debug DLL (/MDd)
    Treat wchar_t as Built-in Type:
    No (/Zc:wchar_t-)
    Create/Use Precompiled Header:
    Not Using Precompiled Headers
    Enable Incremental Linkung:
    Additional Library Directories:
    Additional Dependencies:
    prodevelop.lib protoolkit.lib pt_asynchronous.lib libcmt.lib kernel32.lib user32.lib wsock32.lib advapi32.lib mpr.lib winspool.lib netapi32.lib psapi.lib gdi32.lib shell32.lib comdlg32.lib ole32.lib ws2_32.lib
    Ignore All Default Libraries:
    Generate Debug Info:
    Yes (/DEBUG)
    Randomized Base Adress:
    Disable Image Randomization (/DYNAMICBASE:NO)
    Data Execution Prevention (DEP):
    Target Machine:
    MachineX86 (/MACHINE:X86)

  37. Hello AlexVk, Unfortunately I don't have a working asynchronous Pro/TK application with me. I had one many many years ago but it didn't work in my use cases and so I abandoned it.

    Might I ask if you need to use prodevelop in your Pro/TK app? If you don't need it, have you tried to remove it as a dependency from your project? You can email me at ganeshramiyer at gmail dot com if you want to continue the conversation.

  38. Thanks, to me were possible to adjust the project already. Really prodevelop.lib it was necessary to remove. Thanks for the help.

  39. Hello AlexVk,
    I just want to confirm - you were able to solve your errors? I would love to see your code (just the asynchronous aspect of it, not the unrelated parts), if possible. Thanks.

  40. Write your e-mail and I will send you the project. I won't remove the code, in it there is nothing confidential. A program essence - discovery of models under the order (under the list from a file) and import to them of the parameters received indirect DLL from a database management system. In the code there can be superfluous elements, simply don't pay to them attention, it only a test variant.

  41. Hi AlexVk - my email is ganeshramiyer at gmail dot com. Thanks for offering the async. I really appreciate it. If you are going to post your workspace so that others can download it, then I would be most happy to link to your blog/site where you are hosting it. If you are not going to post your workspace for download, would you mind if I posted it on my blog for others to download? Thanks again.... Ganesh

  42. Hello Ganeshram Iyer! I have sent on your e-mail archive with asynchronous project Pro/Toolkit for a Visual Studio 2008. I don't conduct the blog, and I do not object, that you have laid out article on adjustment asynchronous Pro/Toolkit applications on the blog. But I would like, that you have laid out it not in that type in which I have sent, and a few having finished (having removed superfluous), for the best understanding readers of adjustment of the environment. By the way I live in Republic of Belarus (it in center of Europe :) so we will be on friendly terms. :) If it is possible, send then the link to article in your blog, on my e-mail. Thanks

  43. I was curious if anyone had a WF5 Pro/Toolkit application compiling under Visual Studio 2010 and had the project setting to accomplish that? We are currently building this one part of our application under VS2008 and would love to move it to VS2010 like everything else!

  44. Hello Owen, Sorry for the delayed reply. My colleague and I are working on a VS2010 port of the current Pro/TK project, but unfortunately since we use Pro/Dev in our projects we hit a wall, since Pro/Dev doesn't seem to want to play with VS2010. So till we get our dependencies fixed I am afraid I don't have a solution/workspace for your question. Hopefully soon.

  45. We are dealing with letting things be at VS2008. The current challenge is delivering an application that runs with both 32 and 64bit pro/toolkit. I know I saw 64bit compile settings in some document along the way last year, but I'll be darned if I can find them now. Does anyone have a pointer? Thanks...

  46. Hello Owen,
    Thanks for your very interesting comment. If I understood your comment correctly you were able to successfully get Pro/Toolkit to build for VS2008? My research (and initial experimentation) suggested that Pro/Toolkit does not support anything beyond VS2005, due to header changes (strstream to be specific). I didn't try VS2008 but did try VS2010 unsuccessfully.

    I have a x64 version of the VS2005 workspace in my arsenal and am definitely looking to post that to this blog too. I am currently busy with a product release at my company, but if you need the workspace soon I could send you something (it would be poorly documented) quickly.

  47. Hi,

    I would like to know if i can use Visual studio 6.0 for Pro-E WF4 ToolKit

    If yes, please let me know any change in settings other than mentioned on this post above.

    Thank you,

  48. Hello nica,
    Thanks for your question. I am afraid I can't answer the question "if you can use Visual Studio 6.0". The earliest version of Visual Studio that I had my Pro/TK running in was VS 2003.

    Sorry I can't be more help, but if you do get it working in VS 6.0, let me know. I would be very interested to learn that.

  49. Hi Ganesham,

    We are successfully using VS2008 (32-bit) to build toolkit applications with WF5. There were a specific set of compile options that were dictated in the toolkit documentation and they *required* VS2008 for WF5.

    Of course, now I cannot find the particular part of the documentation as we try to compile for 64-bit. Sigh.

  50. Have built someone project on Windows x64?
    I have a lib files but I haven't a proper function...strange.I can compile my project but I can't link it.

  51. This is a nice article..
    Its very easy to understand ..
    And this article is using to learn something about it.., c#, javascript
    Thanks a lot..!

  52. I have no problem to build 64bit with VS2008 and WF5/creo. if you have problem, you can get my help: o_6(at)

  53. Thanks Anonymous for your comment that you know how to build 64bit VS2008 and WF5/creo. I will be contacting you shortly.

  54. Hi,

    Thanks for your post.

    I tried this program on 64 machine with Proe 5 M60

    I am facing issue linking issue

    1>main.obj : error LNK2019: unresolved external symbol _ProToolkitMain referenced in function _main
    1>C:\Abhijittemp\ProEsampleApplication\Debug\ProEsampleApplication.dll : fatal error LNK1120: 1 unresolved externals

    Do you know any solution for this?

  55. Hello Anonymous,
    Sorry I cannot be of much help. My company and I don't yet build against Pro/E 5. So I have no advice to help with your case.


  56. Thanks for reply. Its OK, I could work with the code for 64 machine with Proe 5 M60 and now working fine...

  57. Thanks Anonymous,
    Could you perhaps post the changes you had to make to get your add-in to work?

    It may help the readers of this blog who have the same issue.

  58. Hi,
    Please let me know if PRO/Toolkit 5.0 DLL mode application can be built with MS visual studio 2010 without service pack (SP).
    Thanks, Samir Joshi

  59. Hi Ganeshram

    For pro/e-5 and 2008, there is need of removal of WIN32;_X86_=1. It works well.


  60. in my previous statement I missed to mention, on 64 bit machine..


  61. Hi Samir Joshi,
    Sorry I missed your comment. Unfortunately I have not successfully built Pro/TK addins with VS 2010, but I haven't spent much time with that combination either.


  62. Hi Ganeshram..thanks for this article!Is helps a lot..
    Was js trying to build the same with a combination of WF4 & VS2010.
    Its throwingup some 79 errors when i rebuild it!I've followed the same procedure you have mentioned.
    Any clues?

    1. Hey Anoop,
      As I mentioned in one of my previous comments (, I am afraid I have not successfully built Pro/TK+VS2010 addin - but mostly due to lack of need.


      Thanks for your comment. I will reply to your email in just a bit.

    2. Something I can not understand.
      Did the application DLLs. Run on the machine on which compiled, all works fine.
      Run on the same machine, where also most of the OS, does not work.
      As it is overcome, otherwise there is no sense at all something to write about?

    3. Hello Anonymous,
      I wish you had provided me some way to contact you directly, as I didn't fully understand your comment.

      Did I understand your problem right - you are able to run the DLL on the same PC you built it, but it is not running a 2nd PC?

      I am afraid I can't answer your question fully without more details, but here are some thoughts:
      1) Are you running the Release build on the 2nd PC? Debug builds link to the debug version of MFC/CRT, which are not redistributable (as per Microsoft's Licensing)
      2) 32-bit vs 64-bit?
      3) The VS built DLL depends on MFC/CRT libraries. Have you tried to install the VC++ redistributables on the 2nd PC?
      4) VC++ also has another layer to fulfill dependencies (aka the embedded/external manifest file). Read up more at

      All of these above suggestions are out of scope for this blog post, but are very relevant to any software development project in VC++. Email me at ganeshram iyer [at] gmail [dot] com if you want to contact me directly.

  63. I am from Russia.
    На русском языке можно вопрос задать, а то у меня разговорный английский слабый, только перевод.

    1. Thanks Anonymous, but unfortunately Я не говорю на русском

  64. Then I will try in English. If what not so, forgive. One of these days I will line a question.

  65. This comment has been removed by a blog administrator.

  66. Hi... I am from India. I am new to creo trying to design a UI dialog box using creo toolkit (C language)
    I am stuck in between.... can u plz mail me an simple example for designing Dialog box with few components on it.

    ProUIDialogPushbuttonadd(char *dialog, char * name, ProUIGrid opt *grid );

    what does grid opts means what form of parameter to pass and how can any 1 plz help me????
    Plz mail me an example related to this


  67. Hello Ganeshram, I wanted to know that I have Creo2.0 installed with Pro-E wildfire 4.0. My creo2.0 files are importing correctly and all features suppress\unsuppress works fine. But when I switch to Creo3.0 from the toolkit API ProSolidFeatVisit() returns only 4 features(datum palnes and co-ordinate system) in feature tree. I am new to Pro-Toolkit and I am not able to find the way out here. Pls help.

    It would be great if you can reply me on my mail-id below.

  68. Programming is very interesting and creative thing if you do it with love. Your blog code helps a lot to beginners to learn programming from basic to advance level. I really love this blog because I learn a lot from here and this process is still continuing.
    Love from Pro Programmer

  69. Hello Ganeshram.. Are you still working with toolkit? if now, please let us know so we dont bother you anymore