Microsoft KB Archive/104095

From BetaArchive Wiki

BUG: HANDLER Sample Builds but Does Not Work Correctly


1.00 1.50 WINDOWS kbtool kbbuglist ---------------------------------------------------------------------- The information in this article applies to: - Microsoft Visual C++ for Windows, versions 1.0 and 1.5 ---------------------------------------------------------------------- SYMPTOMS ======== There are three problems related to the HANDLER sample supplied with Microsoft Visual C++ version 1.0. Only two of the following problems apply to Visual C++ version 1.5: - The test program is called DEMO in the online help file for the Windows Software Development Kit (SDK) Samples (SAMPLES.HLP). The actual name is HANDTEST. - There are no Visual Workbench (VWB) project files supplied for either HANDTEST.EXE or HANDLER.DLL. This problem was corrected in Visual C++ version 1.5. - If built with the supplied NMAKE makefile or through VWB, the sample builds without errors but does not actually count keystrokes as it should. CAUSE ===== The last problem occurs because the assembly module contains a WEP() procedure rather than a _WEP() procedure. Visual C++ normally links a default WEP() procedure into a dynamic-link library (DLL). If you need to perform specialized cleanup (such as the cleanup required by this sample), you must write a function named _WEP(), which is called automatically by the C run-time WEP(). For more information, refer to pages 119-120 of the Visual C++ "Programming Techniques" manual, or pages 27-28 of the C/C++ version 7.0 "Update" manual. RESOLUTION ========== If you have Microsoft Macro Assembler (MASM) version 5.1 or 6.x, the procedure for correcting the problem and building a new HANDLER.OBJ is described below. Creation of the needed project files is also described below. STATUS ====== Microsoft has confirmed this to be a bug in the products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available. MORE INFORMATION ================ To create the needed project files within the Visual Workbench, use the steps below. NOTE: To rebuild HANDLER.OBJ yourself requires a copy of MASM version 5.1 or later. The following steps are required: 1. Open HANDLER.ASM in an editor (VWB will work). Replace WEP with _WEP each place it occurs in the file (there are five occurrences). WEP must be capitalized. Save the file. 2. Make sure that you have MSVC\INCLUDE in your INCLUDE environment setting. HANDLER.ASM includes a header file named WINDOWS.INC, which is not available in the MASM INCLUDE directory. 3. Assemble the file with the command: MASM /Zi HANDLER.ASM If you are using MASM 6.1x and did not install the MASM utility (for compatibility with MASM 5.1), you can use the following command: ML /Zi /c /Zm HANDLER.ASM 4. From the VWB main menu, select Project. Choose New from the menu. 5. Choose the Browse button and ensure that you are in the correct directory (MSVC\SAMPLES\HANDLER). Enter the Project Name as HANDLER.MAK. Choose OK. 6. Select Windows dynamic-link library (.DLL) as the Project Type. If Use Microsoft Foundation Classes is checked, clear the check box. Choose OK. 7. Add the following files to the project: HANDLER.OBJ HANDLER.DEF 8. Build this project. The browse build step will give an error message because there is no source for this module. You can avoid this by turning off the browse option, but it is not necessary. HANDLER must be built before you can create the HANDTEST project because HANDLER.LIB is needed for that project. 9. Repeat steps 1 and 2 but use HANDTEST.MAK as the Project Name. Select Windows-based application (.EXE) as the Project Type. Add the following files to the project: HANDTEST.C HANDTEST.DEF HANDLER.LIB HANDTEST.RC 10. Build the project. Additional reference words: 1.00 1.50 KBCategory: kbtool kbbuglist KBSubcategory: CodeSam

Keywords : kb16bitonly
Issue type : kbbug
Technology : kbVCsearch kbAudDeveloper kbvc150 kbvc100

Last Reviewed: May 6, 2001
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.