Export (0) Print
Expand All
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Using Custom ActiveX Controls with eMbedded Visual Basic 3.0 in Microsoft Windows CE 3.0

Windows CE 3.0

Microsoft Corporation

June 2000

Summary: This paper addresses how to use custom ActiveX controls in the Microsoft eMbedded Visual Basic 3.0 development system. (7 printed pages)

Contents

Introduction
Standardizing the .Idl Files
How to Mark a Control as Usable for eMbedded Visual Basic
   
Adding an ActiveX Control Component
   
Adding and ActiveX Control Object by Reference
   
Adding a Control to an Embedded Device

Introduction

In developing applications for embedded devices using the Microsoft® eMbedded Visual Tools, you may wish to create your own ActiveX® controls.

To do so, you must have Microsoft eMbedded Visual C++® 3.0 development system, the desktop version of Visual C++, and Microsoft eMbedded Visual Basic® 3.0 development system installed on your development machine.

To use your own ActiveX controls, create the desktop version of the control in Visual C++ and the run-time version in eMbedded Visual C++ 3.0, making sure to use the same CoClass UUID for the controls in the .idl files.

Note   Both the desktop and CE device versions of the custom control must have the same UUID. To ensure the UUIDs are the same, follow the procedure described in the section, Standardizing the .Idl Files.

Once the control is created, you can register it as available for your eMbedded Visual Basic projects. For more information on how to create custom ActiveX controls, see the white paper, How to Write and Use ActiveX Controls for Microsoft Windows CE 3.0.

Standardizing the .Idl Files

To ensure that your custom control is usable in eMbedded Visual Basic, you must manually update the .idl file of the embedded control so that the UUIDs match that of the desktop control you have created.

To manually update the .idl file

  1. Open the desktop project in Visual C++, and set the workspace to File View, as shown in Figure 1.

    Figure 1. File View

  2. Open the eMbedded Visual C++ project and set the workspace to File View. Open the same .idl file as the desktop control.
  3. Set the open files side by side and copy the UUIDs from the desktop project into the embedded project.
    Note   Figure 2 shows only three UUIDs from each project, because that is what appears in a single screen. There are actually four UUIDs that need to be updated for this example. When working with your own custom controls, scroll through the .idl files to make sure you have updated all of the UUIDs.

    Figure 2. Updating UUIDs

How to Mark a Control as Usable for eMbedded Visual Basic

Adding an ActiveX Control Component

The way an ActiveX control is used determines how it is added to a project in eMbedded Visual Basic. Some controls are added as components that can be dropped onto a form at design time. These ActiveX controls are first added to the Components dialog box, and then added to the Toolbox. Then they can be placed directly on a form. Others, such as the ADOCE and Finance controls, are added as objects via code; adding control objects is discussed in the section, Adding an ActiveX Control Object by Reference.

To add an ActiveX control component

  1. Make sure the desktop design control is registered.
  2. In eMbedded Visual Basic, to open the Components dialog box, click Project and then click Components, as shown in Figure 3.

    Figure 3. Components dialog box

  3. Click Browse, and navigate to the desktop control, as shown in Figure 4.

    Figure 4. Navigating to the desktop ActiveX control

  4. Select the dynamic link library (DLL) that contains the control, and then click Open, as shown in Figure 5.

    Figure 5. Opening the DLL

    At this point, you will receive a message informing you that the control will be marked as usable for the current platform, and will be added to the toolbox.

  5. Click OK to finish.

The control, while now available at design time, will not be automatically downloaded to the device when the project is built, so you will need to use the Control Manager or eMbedded Visual C++ to add the control to the device, as described in the section, Adding a Control to an Embedded Device.

Adding an ActiveX Control Object by Reference

If a control is added as an object via code, rather than dropped onto the form, you must add a reference to the control in the References dialog box. If you wish to create an object for which you can write event handlers, use the CreateObjectWithEvents function to instantiate the object. If you wish to create an object that does not fire events, or for which you do not need to catch the events fired, use the CreateObject function. Both of these functions create invisible ActiveX controls only; they cannot create graphical ActiveX controls.

To add an ActiveX control object by reference

  1. Make sure the desktop design control is registered.
    Note   Both the desktop and CE device versions of the custom control must have the same UUID.
  2. In eMbedded Visual Basic, click Project and then click References to bring up the References dialog box, as shown in Figure 6.

    Figure 6. References dialog box

  3. Select Browse, and navigate to the desktop control.
  4. Select the dynamic link library (.dll) that contains the control, and then click Open.
  5. At this point, you will receive a message informing you that the selected library will be marked as usable for the current platform. In the References dialog box, click Yes to add a reference, which is then marked as usable.
  6. Click OK to finish.

Adding a Control to an Embedded Device

To add a control to an embedded device

  1. Click Tools, point to Remote Tools, and then click Control Manager to activate the Control Manager in eMbedded Visual Basic.
  2. In the left pane of the Control Manager window, shown in Figure 7, select the target device to which you wish to add a control. You can choose an emulator or a Windows CE device.
  3. In the right pane, a list of controls appears. As shown below, a Yes or a No in the right pane indicates whether the installed devices are available in the design or device/emulation environments.

    Figure 7. Control Manager window

  4. Highlight the control that you wish to install, and then select Install to Target from the Control menu. The control is installed and registered to the target device or emulation environment. The device/emulation column in the right pane confirms that the installation is successful.

To install a control not listed in Control Manager

  1. From the left pane of the Control Manager window, select a device.
  2. From the Control menu, select Add New Control.
  3. Select the dynamic link library (DLL) that contains the control.

    The .dll file will be copied and then registered on the device or in the emulation environment.

Show:
© 2014 Microsoft