VBCE.com - The Premier Website For Visual Basic/CE Developers

 

*Dev Corner

Sample Code
Controls
Workarounds
Tips & Tricks
Q & A
Forums

*Goodies
Downloads
Software
Bookstore


*General
Home
What's New
General Info
Misc. Info


*News Worthy
News
Articles
Editorials
KB Articles
Reviews
Awards

*Miscellaneous
Web Links
Partners
Search
Feedback
Advertising

<% On Error Resume Next SiteStats() %>

Sponsors


More...


 

Download Entire Document

At this point we are assuming your CE control has already been created. 

  1. Write down the names of the source code files in the CE Version of the project. These files should have the following extensions: .cpp, .h, .odl, .idl, .rc, and .def.
  2. Close the CE version of the project (If it is open)
  3. Now, you will use Visual C++ to create a BRAND NEW "Win32" PROJECT with the same name as the original control (Place the control in a different directory than the original).
  4. Win32 Project

    NOTE: For MFC controls, use the MFC ActiveX ControlWizard; for ATL controls, use the ATL COM AppWizard. At this point you should have 1 project for the CE version of the control and a 2nd project for the desktop "Win32" project type.

  5. Except for stdafx.cpp, delete all source files, headers, and dependencies from the new "Win32" project and close the new project workspace.

    Delete Files!
  6. Close the entire WorkSpace in Visual C++.
  7. Using Windows Explorer, find the directory where you created the Win 32 Desktop version of the CE control. Rename the .dsp and .dsw files by appending "_win32" to the original filename.
  8. Rename Files!

  9. With a text editor, such as Notepad, open the new .dsw file, change the "*.dsp" text to whatever you renamed the .dsp file to in the step above, save your changes, and then close the .dsw file when done editing.

    Modify .dsw

  10. Copy the new .dsp and .dsw files to the original CE control project directory. This directory contains the original .dsp and .dsw files, plus the source files.

    Move Files
  11. Open the new "_win32" .dsw file in Visual Studio as a workspace and add the files from step 1 to this project.
  12. NOTE: AT this point we are going to be getting ready to compile the application for the Desktop version of the control. This version will only provide the method, properties, and event stubs for the calling application. Therefore, to eliminate compile errors (Since we are really compiling CE specific code in a Win 32 environment) you should add conditional "CE". Surround the existing code with #ifdef UNDER_CE and #endif. You should surround all code except the function header and return value.

    Add Conditional Code
  13. Before you compile, change the output control name to the same name as the original control project name. This control name is specified in Project, Settings, Link, and Output file name.
  14. In order to make the control a valid Windows CE Control, you must add a registry hack by modifying the .rgs file in the _win32 project as seen here:

  15. Registry Settings

  16. At this point, you may need to make misc changes to the project source code to account for Unicode and ASCII string usage – Windows CE is Unicode only, and Windows 95/98 is ASCII only – and to account for the differences between the Windows CE operating system and Windows desktop operating systems. See Step 10 for conditional compilation.

 

Recompile and you should now have a Windows version of your Windows CE ActiveX control.

After compiling the CE version (For emulation and the Device), and the Win32 project for the desktop, you should be able to add the control to the Visual Basic Toolbox.

If you try and add the control to your VB application and you get the familiar error:

Make sure you followed Step #12!

If step #12 did not work correctly, you must manually add a new key within the registry to your control. Adding the key of "Windows CE Control" will allow your control to be placed on a VB form.

1) Start RegEdit

2) Use the Find option (Under the Edit Menu) to search for the name of your custom control.

3) Once the control is found, you must add a new key called "Windows CE Control"

RegEdit

 

Final Steps

The final step in registering the CE desktop version of your ActiveX control is to use the CE Control Manager. Register the desktop version of your control in the appropriate environment (Palm-Size, H/PC, H/PC Pro, etc..) using the Control/Add New Control menu.

cecontrolamanager_small.gif (1946 bytes)

 

Download Entire Document

 

License Agreement

This document is provided "as-is". Neither the author nor its suppliers makes any warranty, express or implied with respect to the content of this software or the accuracy of any information contained herein, including, without limitation, the implied warranties of merchantability or fitness for a particular purpose. Because some states / jurisdictions do not allow exclusions of implied warranties, the above limitation may not apply to you.

In no event shall the author or its suppliers be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use this product, even if the author has been advised of the possibility of such damages. Because some states do not allow the exclusion or limitation of liability for consequential or incidental damages, the above limitation may not apply to you.

Distribution
Freeware - this document is provided "as-is". Neither the author nor its suppliers makes any warranty, express or implied with respect to the content of this document or the accuracy of any information contained herein, including, without limitation, the implied warranties of merchantability or fitness for a particular purpose.


VBCE.com is DevX Winner!

Unless otherwise noted, all information on VBCE.com is Copyright 1998 - 2002
Windows, Windows CE, and Visual Basic are trademarks of the Microsoft Corporation.
VBCE.com is not responsible for content on external sites.
Send all feedback to webmaster@vbce.com
Webmasters - feel free to link to
VBCE.com - Premier Website for Visual Basic/CE Development

Buy Books!