ControlWizard Generates Both 16-bit and 32-bit ProjectsLast reviewed: October 12, 1995Article ID: Q125242 |
The information in this article applies to:
SUMMARYThe ControlWizard included with the Microsoft OLE Control Development Kit (CDK) generates both 16-bit and 32-bit projects. In most cases, you can develop your control on either a 16-bit or 32-bit platform, and then rebuild the control on the other platform.
MORE INFORMATIONWhen ControlWizard is used to create an OLE control, two projects are generated. The full project name you specify is used as the base name for the 16-bit MAK file and other files used by the 16-bit IDE. The first six letters of the project name followed by "32" are used to create a base name for the 32-bit MAK and DEF files and other files used by the 32-bit IDE. For example, if the full project name is TESTCTRL, these two MAK files are generated:
TESTCTRL.MAK -- 16-bit Project File TESTCT32.MAK -- 32-bit Project FileControlWizard also generates a 'makefile' file that NMAKE can use to generate either a 16- or 32-bit project by specifying the WIN32 flag on the command line. For example:
nmake WIN32=1 // 32 bit version nmake WIN32=0 // 16 bit versionWithin the generated source files, place platform-dependent code in conditional compilation blocks, as shown in this example:
LRESULT CTestCtrl::OnOcmCommand(WPARAM wParam, LPARAM lParam) { #ifdef _WIN32 WORD wNotifyCode = HIWORD(wParam); #else WORD wNotifyCode = HIWORD(lParam); #endif // TODO: Switch on wNotifyCode here. return 0; }To maintain platform independence, use conditional compilation blocks to isolate platform dependencies in the code you add to your control. Use the #error statement to flag features that are not implemented for one platform or the other. For example, you might code the previous example like the following if the 32-bit implementation was not complete:
LRESULT CTestCtrl::OnOcmCommand(WPARAM wParam, LPARAM lParam) { #ifdef _WIN32 #error OnOcmCommand parameter decoding not completed for Win32! #else WORD wNotifyCode = HIWORD(lParam); #endif // TODO: Switch on wNotifyCode here. return 0; }Note that because separate project files are used for 16- and 32-bit targets, all project maintenance will need to be performed for both projects. Project maintenance activities include:
|
Additional reference words: kbinf 1.00 2.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |