Hi All,
I'm trying to get started with the MicroStationAPI. I think I've read all that there is to read about the API now!
I'm a little confused, when I create my MFC DLL project in VS2008, there is no DllMain which supposedly should have been created automatically. A few questions about the generated solution;
If anybody could give me a few pointers it would be greatly appreciated.
Ian: I create my MFC DLL project in VS2008. Can MFC dialogs be used within the dll?
I create my MFC DLL project in VS2008. Can MFC dialogs be used within the dll?
I'm going to qualify my previous response. I just noticed that you are using VS2008 (VC9). One thing you must consider is the MFC run-time lib, mfcX0.dll. If you build using VS2005, then you're linking with mfc80.dll; but if you're linking with VS2008, then you're linking with mfc90.dll. AFAIK MicroStation V8.11.xx.xx is built with VS2005 and you will have a mis-match between the MFC libs.
Regards, Jon Summers LA Solutions
Jon Summers: I'm going to qualify my previous response. I just noticed that you are using VS2008 (VC9). One thing you must consider is the MFC run-time lib, mfcX0.dll. If you build using VS2005, then you're linking with mfc80.dll; but if you're linking with VS2008, then you're linking with mfc90.dll. AFAIK MicroStation V8.11.xx.xx is built with VS2005 and you will have a mis-match between the MFC libs.
OK, so does this just mean that I cannot use MFC objects within the dll, but I can still compile using VS2008?
Ian: Does this just mean that I cannot use VS2008 MFC objects within the dll?
Does this just mean that I cannot use VS2008 MFC objects within the dll?
That's my understanding. I'll be happy to be corrected — then I could use VS2008 as well. If you want a user interface, then you can use either MDL dialogs & widgets or a non-MFC Windows library such as the Windows Template Library.
Ian: I can still compile using VS2008?
I can still compile using VS2008?
Viz Studio provides an interactive development environment (IDE). An IDE is just that — not a compiler and not a linker. When you build a project using Viz Studio, it invokes the Microsoft C++ compiler and the C++ linker.
You can also use another build tool, such as Bentley Make (bmake) to compile & link your code. That is exactly what happens when you build one of the MDL examples, which from V8i are written in .cpp files. bmake invokes the Microsoft C++ compiler and the C++ linker.
Jon Summers: Viz Studio provides an interactive development environment (IDE). An IDE is just that — not a compiler and not a linker. When you build a project using Viz Studio, it invokes the Microsoft C++ compiler and the C++ linker. You can also use another build tool, such as Bentley Make (bmake) to compile & link your code. That is exactly what happens when you build one of the MDL examples, which from V8i are written in .cpp files. bmake invokes the Microsoft C++ compiler and the C++ linker.
Ah ha! I've actually only just managed to find the examples - I didn't realise that they'd been tucked away in My Docs since the install! I'll try setting up an external tool in VS to build using bmake.
So really, I could just use the files generated from AppMakerPlus, add them to a VS Project, and use bmake to create *.dll & *.ma files (correct me if I'm wrong!). Thanks for your help Jon!
Ian..
So far, it should be OK to use the AppMakerPlus files to create your files, bmake (if ENV is set correctly - look for VS2008 in this forum) will do the work of compiling and linking your stuff.
For the version problem of MFC. Dan Paul has used static binding for MFC to overcome the problem of the different MFC versions. You might try this to. Otherwise there is currently no known way to compile&link MFC8 apps with VS2008. After the CBFramed...-dialog libs are all build with MFC8 this is the current state. Nevertheless you might use your own MFC(9) dialogs, but I would not suggest this. They will not be part of Ustns window management, message handling is difficult and so on. (I know what I'm speaking of :( )
From my own experiences, if I would not have used MFC for such a long time (~7 years now) I would switch to ustn-dialogs, even because you have some pieces (like color picker) for free, that you will hardly get in MFC. And youre using the same messaging system as ustn itself. On the other hand, if you have questions for MFC-dialogs, I will try to answer them. Meanwhile got most of the stuff working (incl. toolsettings, modeless dialogs, tooltips and correct cleanup for primitive commands). But I'm currently using VS2005 for development. I even use a little different kind of building my app (ma and dll separate), but this has historical reasons and produces a similar result.
For the debugging question: you can attach VS to a currently running Ustn session and set your dll as additional dll (inside VS) and you will be able to set breakpoints and visit your sourcecode. You cannot use edit&go (this is one reason why I stay at my separated generation - I can use this), so you have to leave ustn (or unload your app) make your changes, use bmake to recreate and run again.
HTH Michael