RoxxSoft Development Blog
Posts tagged express
COM without MFC/ATL/Whatever
Nov 6th
I’ve seen a lot of programmers lately that write COM as one of the things they are experts at, but, once you actually put them to the test, they turn out to know the bare minimum of what COM is and how to use it, and why is this? most of them turn out to be Visual Studio programmers, not actually C/C++/C#, etc programmers.
By Visual Studio programmers i mean, those who can only code with VS, take them out of the environment and they are completely lost, ask them to create a windows application without the application wizards and it’s a no go.
Of course most of the people would say, it doesn’t matter, what are the chances that you end up having to work without VS?, yeah i know, if you know where to look for work, you will never find yourself under those circumstances, but how sad that is for anyone who sells himself as a true professional?
Anyway, i had a rather funny situation in which i wrote a c# com object and loaded it from c++, one of the programmers was very impressed, because as far as he knew, you could use c++ from inside a c# application, but not the other way around, so i explained that the c# object was a COM object so there was no problem loading it from c++, but he could not really get it, and why? because funnily enough, he thinks COM is a c-only technology, well now he knows better, but wait, why was this guy hired in the first place? as a windows programmer, to lead the development of a windows application that uses COM as one of the principal technologies with an Office add-on and IE plug-ins and a lot of COM related programming, but he doesn’t really understand anything that is happening, VS does all the heavy work.
So i though about it and decided to write a very simple IE plug-in using the Visual C++ Express edition as with all the code on this site, by reading the code of this plug-in you will be able to see how a COM object actually works without wizard generated code or anything else but what you will find on the source files of our project.
When i say, COM without MFC/ATL, what i mean is, most of the people i know that use COM think it is somehow heavily related to using MFC or ATL, when in fact it is not, there are even those who for some reason believe COM == OLE, how can this happen, for one i think Microsoft’s documentation about COM is very hard to understand for beginners, and second, by using tools like VS most of the knowledge developers could get is taken away from them by the wizards that write all the code and just leave the developer to fill in the methods, which leads to developers who depend on the generated code since they just know that by filling those methods things will work out ok, without having to understand how or why.
So, for those who really want to learn the how and why, I’ll be posting a simple tutorial on the very basics of COM, and i mean really very basics, starting from how a class is made and virtual tables and pointers to methods, interfaces, etc.
Now i would like to ask all windows programmers out there, how much do you really think a software developer needs to understand about windows technologies to describe that person as an “expert” ?
Simple Win32 application with source code
Oct 2nd
My last post generated some mail about how to use a .rc file from inside Visual C++ 2008 Express, so i decided to post this little example of an application made using resedit, basically what is contained here is a .rc file, a cpp file that uses it, and a resource.h file which contains some definitions.
I’ve used resedit because at least for me, it is as good as any Microsoft application, and it is free, fast, small and i like to work with it, of course you can choose whatever suits you best, but resedit is the best for me. :), if you don’t know where to find this app, please have a look at my post about resource editors, where you can find links to the most popular ones.
To recreate a project like this one, first you need to create an empty project in Visual C++, then, just add an empty .cpp file, then, in resedit, generate at least one dialog, with all the controls you need, save the .rc file into the same folder where your Visual C++ project is, then import the file into the editor by right clicking over the Resource Files section in the Solution Explorer, then select your .rc file.

If you generate the c++ code from inside resedit, only import the resource.h file, forget about the generated .cpp file, after including those files, all you have to do is write the windows procedure and the windows main function and that’s it, the zip file i have linked here has a very simple win32 application that does all these things, if you are interested to know how to build a simple application without too much effort have a look at the code sample, i was going to write a little tutorial about win32, but, the app is so simple that i believe it is better to just explore the code and use the msdn docs to learn about how it works.
After importing the .rc file into Visual C++, you can still change it from resedit, everytime you save your changes, the Visual C++ editor will notify you and allow you to reload the .rc file, this makes it very easy to keep working with both tools open and without locked file conflicts.
Click here to download the code: win32App.zip
Hope this is useful to you, if any doubt comes along, you are free to ask :), i will try to help but please remember it may take some time to see your questions since i don’t check the blog everyday.
Depending on the free time i have, i am considering writing some tutorials about win32, but i think there are some good ones already on the web. anyway, maybe if enough people are interested i’ll do it.
Visual resource editor for Visual C++ Express
Sep 26th
As mentioned in a previous post, after installing the Express edition of Visual C++ 2008, i found out it didn’t had a visual resource editor, while the c# express compiler does include one, so i started to look for an alternative and after looking at various commercial apps i found some free ones:
Very cool resource editor, free, not open source though:
ResEdit
This one includes the complete IDE, it is open source and seems to work with several compilers:
http://www.ultimatepp.org/
Here is another one, seems ok, not tested:
http://www.wilsonc.demon.co.uk/d10resourceeditor.htm
And of course there are a couple commercial ones, i found this one to be good:
http://www.resource-builder.com/download.html
But i did not use it so much to have a real world opinion so…
While the Visual c++ 2008 express edition seems to be targeted to students or beginners, i found that very hard to believe, without the resource editor, how are they supposed to get up to speed?, by programming like 25 years ago? I guess it is in microsoft’s best interest to move everyone into using c# as soon as possible.

Recent Comments