Tech Note 02: Controls Overview

July 26, 2007


© NSB Corporation. All rights reserved.

NS BASIC/CE allows you to use external routines called ActiveX Controls with your programs. They are available from Microsoft, NS BASIC Corporation and from third parties. New ones can be developed easily by someone who know how to use eMbedded Visual C++.

For information on writing ActiveX controls, see How to Write and User ActiveX controls for Windows CE 3.0.

Microsoft's Standard ActiveX Controls

The installation procedure for NS Basic/CE installs and registers the complete set of Microsoft ActiveX controls for Windows CE, if they are not yet already in ROM.

Once the control is installed on your WinCE device, use the addObject statement to create an object from the control. For details on using each control, consult the documentation for that control in the Technotes. Microsoft also has documentation as part of the embedded Visual Basic toolkit, which can be downloaded from Microsoft's website.

We would like to report that all the ActiveX controls work perfectly, but such is not the case. However, we think they are valuable additions to the environment and they have been greatly improved in the December '98 update. The updated objects are installed by NS Basic/CE 2.0 and higher.

Microsoft's ActiveX controls are documented in other Tech Notes. There is additional information on Microsoft's website.

There are also a number of third party controls that replace the Microsoft ones. They are less buggy and have many additional features.

Visual Basic for CE Redistributables Kit (VBCERK) 1.0

This is an archive of the standard ActiveX controls from Microsoft. You may redistribute them with your application. The files are organized by CPU type and do not have installers: you need to either create an installer, or move the files to the \Windows folder on your device using the ActiveSync Explorer.

How to register a control on an HPC, HPC Pro or HPC 2000

How to register controls on Palm-size devices:

How to register controls on a Pocket PC:

How to register controls from NS Basic/CE

Often, the easiest way to register a control is to do so from NS Basic/CE itself. Use NS Basic/CE's SHELLEXECUTE command.

SHELLEXECUTE "open","regsvrce.exe","NSCEPictureBox.ocx"

How to add a third party ActiveX control to your program

NS Basic/CE makes it easy to use controls from third parties. Most any well behaved ActiveX control written for Windows CE will work. Use the AddObject statement (see the Handbook for more information) to add the control to a project.

The first argument of AddObject is the ClassID of the control. This is not the same as the filename. It is the name that it appears under in the Windows CE registry in HKEY_CLASSES_ROOT. You can get this name from the author of the control, or by looking at the registry using a tool such as the Registry Editor that comes with embedded Visual Basic. if there is a desktop version of the control, do not assume that the Windows CE ClassID is the same.

You can also examine the registry using a tool like the Remote Registry Edition, available here:
(if you find another good registry editor, let us know!)

If the object is visual or generates events, the last 4 arguments of AddObject (the bounds) must be supplied.

How to put third party controls inside Frame

If the ActiveX control you want to use doesn't support some behaviors such as showing/hiding itself, you can put the object inside the Frame control. And then methods applied to the frame will be automatically applied to the object. To make the third party control a child of the frame, assign the frame's HWND to the object's parent HWND. The MGCEWin32 control is very useful to do this:

    lWnd = API.WindowFromPoint(x,y)          ' API as MGCEWin32
    lChild = API.GetWindow(lWnd, WINDOWNER)

    API.WindowParent(lChild) = Frame.hWnd    ' assign frame's hWnd

lChild may be acquired by other combinations of MGCEWin32 functions.

List of Active X controls for NS Basic/CE