The linker message is just going to say no body for prototype function found.
The ".H" file contains a prototype header, however the ".c"/".cpp" file contains no body code for that prototype.
So the compiler will basically see a forward declaration of a prototype which it will connect but when it gets passed to the linker it can't match the forward declaration to a code body and so it will report that accordingly.
The MSDN blog describes the problem they forgot to cull the prototype header before they got locked for compiler release.
I am using CCriticalSection and CSingleLock for synchronization purpose.
Is there a mechanism to test the synchronization object to know whether it is locked from another thread?
That is, I don't want to enter the lock, but just want to know whether the synchronization object is locked or not without blocking my code.
MFC is weird in a number of areas it isn't equivalent to the WIN32 API in a great many respects.
You have run across this a number of times with things like it is a singular thread, it's modal dialogs are in fact not WIN32 modal in MFC they become modal via the message loop. You seem to have identified MFC static text has got some different behaviour as well.
The thing about SS_OWNERDRAW on a true Win32 static class is you don't override it on the static itself but rather the dialog owner is sent the WM_DRAWITEM message and it is expected to handle it for the static class
By using the SS_OWNERDRAW style, an application can take responsibility for painting a static control. The parent window of an owner-drawn static control (its owner) receives a WM_DRAWITEM message whenever the static control needs to be painted. The message includes a pointer to a DRAWITEMSTRUCT structure that contains information that the owner window uses when drawing the control.
My biggest reason for not ever using MFC is that you can't mix pure Win32 code with MFC easily and reliably. The newer WPF framework allows Win32 Interoperation with only a limited few restrictions. For example in your case it would have been nice to have just written a nice pure Win32 dialog code to do what you want but MFC can't call a native Win32 dialog process because it has its own message pump loop and it's dialogs aren't really modal.
If you want to look at the message pump which is very MFC specific goto CWnd::RunModalLoop function and you can see how it pumps messages into the framework via
If you are using MFC you need to ignore native Win32 it won't always work. Probably use it as a guide as how it might work if MFC not as how you should do it on MFC. From you prior answer it is also obvious MFC window frames aren't exactly like Win32 native frame either.
If your project isn't large I think you have now reached a level of understanding of Win32 you could dispense with the MFC framework and just have a pure Win32 application. You seem to spend more time fighting the framework than actually coding new stuff. So the question I would put to you would be what do you like about the MFC framework, what positives do you have.
To Answer your question When looking at Windows apps almost all are C++ just look at the articles examples on The CodeProject What % is Win32 and how much is MFC I would say 80 % of the Windows examples are MFC why is that ? Of course now C# seems the way to go by that is for Web Development
What do most people use for Windows Developement ?
What do most people use for Windows Developement ?
I use pure Win32 from C++ and find it works just fine. I used to write MFC in my professional life but found it over complicated in many areas. I also use C# and find that so much easier, and more powerful than MFC.
There are more in MFC because it is technically easier for the amateur to play with. In the same way Visual Basic has a following and takes up a lot of programming space for what it really is. Your coding is now clearly moving well beyond amateur and you clearly grasp what is actually happening at the lower levels so there is no reason you couldn't get rid of the training wheels being provided by MFC.
Commercially it isn't about what is more used it is what will survive over time. So long as Windows exists you will be able to port code written on native Win32 API and the Win64 API system already fully supports all the Win32 API. In fact the old original Win16 API is still pretty much supported intact in both these systems. It's the simple reason companies spending serious bucks on coding that is expected to last a long time insist on it. Now if you are playing in short lived markets like games, webpages etc you don't worry about that so much. Given you have got your head around the API something most amateurs struggle with to me at least it just seems silly to not code on it especially if you are doing this commercially.
On large scale Commercial windows programs you will be almost always be on Native Win32/Win64 (possibly with .NET) unless you are playing with a very specific market. A quick look at Microsoft/IBM and strangely even google programmer demographics shows you that. The other major thing that same majority can do is program in Java.
The reason you choose any framework should always be for speed of development but the downside is the framework is always a liability for ongoing support.
If all you are using MFC is to create dialog and windows layouts you would be better off using a Resource Editor to visually lay up the windows/dialogs and then directly load the resource files. Both C# and WPF framework use this trick but most of us old timers do it that way with code stubs we have written. I have a couple of functions in my private library that can read RES/RC or dialog resource DLL files and return to you the constructed window when requested. The formats are really not challenging and it's all well documented on the internet.
I use Resource Builder from Microsoft which has a price tag but if you want to play with the idea, OpenWatcom C++ and LCC_32 have free resource editors and are free to play with. You can load save .RC or .RES files directly from the visual editors. If you want some stubs to load the files at runtime I am happy to provide some functions.