DOCUMENT:Q193235 29-SEP-1998 [vbwin] TITLE :SAMPLE: VBCEComm.exe Uses the MSCEComm Control in Emulation PRODUCT :Microsoft Visual Basic for Windows PROD/VER:WINDOWS:1.0 OPER/SYS:WINDOWS KEYWORDS: ====================================================================== --------------------------------------------------------------------- The information in this article applies to: - Windows CE Toolkit for Visual Basic 5.0, version 1.0 --------------------------------------------------------------------- SUMMARY ======= VBCEComm.exe is a sample that illustrates the basics of the MSCEComm control and demonstrates how to access the serial ports through the emulator. MORE INFORMATION ================ The following file is available for download from the Microsoft Software Library: ~ VBCEComm.exe Release Date: Sep-28-1998 For more information about downloading files from the Microsoft Software Library, please see the following article in the Microsoft Knowledge Base: ARTICLE-ID: Q119591 TITLE : How to Obtain Microsoft Support Files from Online Services WARNING: ANY USE BY YOU OF THE CODE PROVIDED IS AT YOUR OWN RISK. Microsoft provides this code "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. VBCECOMM.EXE Readme ------------------- What's Required? ---------------- 1. This sample requires the updated version of MSCEComm.dll from the Windows CE ActiveX Control Pack available at: http://www.microsoft.com/windows/downloads/contents/other/ ceactivexctrlpak1/default.asp 2. To allow the MSCEComm control to access the serial ports on the desktop under emulation, the DDK needs to be installed during the Platform SDK installation. To install, run the setup program and use the Custom install option. Select "Device Driver Development Kit." This will install the wceemuld device necessary to make the MSCEComm control work in emulation. Reboot the machine after the wceemuld device is installed. 3. The mobile device connection must be disabled after launching the project. This is required due to the fact that the sample program uses the same serial port for communications. 4. Windows NT 4.0 with SP3 or higher must be installed on the desktop. Scenarios --------- The VBCEComm.vbp sample was tested with the following scenarios: 1. Serial communication between emulation on the desktop and the remote device (connected to the same desktop); 2. Serial communication between emulation and emulation with the two desktops connected using a null modem cable; 3. Serial communication between emulation and the desktop running the VB 5.0 sample serial application (VBTerm.exe). VBTerm.exe is also included in the self-extracting VBCEComm.exe file. The two desktops are connected using a null modem cable. Step-By-Step Instructions ------------------------- Scenario 1 (emulation to remote device) --------------------------------------- 1. Connect the H/PC device to the desktop. 2. Open the VBCEComm.vbp project in Visual Basic 5.0. 3. Select VBCEComm Properties from the Project menu and change the Run on Target option to "Remote Device." 4. Press F5 to run the project. A copy of VBCEComm will be running on the remote device. 5. On the desktop machine running emulation, close the emulation window if it is open. All applications running in emulation must be stopped and all emulation windows and debug windows must be closed in order to start up the wceemuld device. 6. Click on Start, Programs, Microsoft Windows CE Services and then Mobile Devices. On File menu, uncheck "Enable Serial Communication". 7. In the Control Panel, double-click on the Devices icon. 8. Select the Serial device driver and click the Stop button. 9. Select the wceemuld device driver and click the Start button. 10. In the VBCEComm project, Select VBCEComm Properties from the Project menu, and change the Run on Target option to "Emulator". 11. Press the F5 key to run the project in emulation. 12. Click on the "COMM Start" button on both ends. Leave the default settings unchanged and click OK. If you want to change the settings, make sure the settings on both ends match. 13. Type in some text in the "Write (Outgoing) Text" box and click the "Send Text" button on one end. The text should appear in the "Read (Incoming) Text" box on the other end. NOTE: The desktop system may need to be shut down, powered off and then turned back on in order for the text to be successfully sent. This will require steps 7-9 to be repeated. Scenario 2 (emulation to emulation) ---------------------------------- 1. Click on Start, Programs, Microsoft Windows CE Services and then Mobile Devices. On File menu, uncheck "Enable Serial Communication". 2. In the Control Panel, double-click on the Devices icon. 3. Select the Serial device driver and click the Stop button. 4. Select the wceemuld device driver and click the Start button. 5. Use a null modem cable to connect the two desktop machines. 6. Open VBCEComm.vbp with the toolkit on both desktops. 7. In the VBCEComm project, select VBCEComm Properties from the Project menu and change the Run on Target option to "Emulator." 8. On both desktops, press the F5 key to run the project in emulation. 9. Click on the "COMM Start" button on both ends. Leave the default settings unchanged and click OK. If you want to change the settings, make sure the settings on both ends match. 10. Type in some text in the "Write (Outgoing) Text" box and click the "Send Text" button on one end. The text should appear in the "Read (Incoming) Text" box on the other end. NOTE: The desktop systems may need to be shut down, powered off and then turned back on in order for the text to be successfully sent. This will require steps 2-4 to be repeated. Scenario 3 (emulation to VBTerm application) -------------------------------------------- 1. Click on Start, Programs, Microsoft Windows CE Services and then Mobile Devices. On File menu, uncheck "Enable Serial Communication." 2. In the Control Panel, double-click on the Devices icon. 3. Select the Serial device driver and click the Stop button. 4. Select the wceemuld device driver and click the Start button. 5. Use a null modem cable to connect the two desktop machines. 6. Open VBCEComm.vbp with the toolkit on one desktop. 7. In the VBCEComm project, select VBCEComm Properties from the Project menu and change the Run on Target option to "Emulator." 8. Press the F5 key to run the project in emulation. 9. Run VBTerm.exe on the other desktop. 10. In the VBTerm application, select Open Port from the CommPort menu. 11. In the VBCEComm project, click on the "COMM Start" button. Leave the default settings unchanged and click OK. 12. Type in some text in the "Write (Outgoing) Text" box and click the "Send Text" button on one end. The text should appear in the VBTerm application running on the other end. Troubleshooting Tips -------------------- 1. If the error message "Unable to Load Startup Form" appears when running on either emulation or on the remote device, select Control Manager from the Windows CE menu in the Visual Basic design environment and ensure that the MSCEComm control is registered for use in each. For additional information, please see the following article in the Microsoft Knowledge Base: ARTICLE-ID: Q185204 TITLE : HOWTO: Use the Control Manager in CE Toolkit for Visual Basic 2. The DTREnable property of the MSCEComm control must be set to TRUE. 3. If communication fails, shut down the desktop computer and turn off the power. Wait for a few seconds and turn it back on again. 4. If wceemuld device fails to start, check to see if the emulation window is closed already. If not, close the emulator, reboot the machine then start the wceemuld device again after stopping the serial device, which starts up automatically by default. 5. If the serial device fails to stop, check to see if the mobile device connection is disabled. The machine may need to be rebooted in order to be able to stop the serial device again. Additional query words: kbdss kbDSupport kbVBp vbce kbAddIn kbWinCE100 kbVBp500 kbToolkit ====================================================================== Version : WINDOWS:1.0 Platform : WINDOWS Issue type : kbhowto ============================================================================= THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY. Copyright Microsoft Corporation 1998.