I have been trying to get your sample Control Panel applications using MFC to run under Windows NT 3.51. The samples (as shipped with the Developer Network article "Creating Win32 Control Panel Applets with Visual C++" and other tech articles) just don't seem to run.
I successfully set a breakpoint in DllMain and in the constructor of the App object, and everything seems to be initialized and constructed properly. The CPlApplet function never gets called, but interestingly enough DllMain() gets called for ATTACH and TERMINATE real quick before any real work gets done. The only clue you get that CONTROL.EXE is even interested in the .DLL is the trace message in the debugger that the .DLL was loaded and another icon does show up in the Control Panel, but it is always the ODBC configuration icon. If I put two sample CPL applets in the \system32 directory, I get two bogus ODBC icons there (that really do function as ODBC Control Panel apps.)
Where is Nigel Thompson? (Or at least his brain?)
Andy Levine
After poring fruitlessly through his neurosurgery textbook in search of the answer, Dr. GUI found Knowledge Base article #Q151034. According to the Knowledge Base, the applet entry-point function, CPlApplet(), exported by the MFC control applet, is resolved to the function exported from ODBCCP32.LIB rather than the function exported from the project.
Every Control Panel application must export the standard entry-point function, CPlApplet, that is called by Control Panel in various situations. When you include AFXDB.H in your project, MFC pulls in the ODBCCP32.LIB file through a #pragma comment(). This is the import library for the ODBC installation .DLL that also exports CPlApplet. The linker resolves the CPlApplet function from the ODBCCP32.LIB rather than from your object files. Since CPlApplet resolves to the one in ODBCCP32.LIB, your Control Panel applet acts as another ODBC Control Panel applet.
See the article at http://www.microsoft.com/kb/articles/q151/0/34.htm for steps to resolve this issue. Also note the new path for Knowledge Base articles.