Adding Controls to a Formless Application

Applications with forms can store a control on a form. The control is created when the form is initialized. However, for a formless application you must create a control dynamically and store a reference to the control in a variable. After you assign the new control to the variable, you can use the variable to refer to the objects, constants, methods, and properties of the control.

The following procedure shows how to create a FileSystem control for a formless application.

    To dynamically create a FileSystem control

  1. Choose a new Windows CE Formless Project.
  2. Choose OK to select H/PC Ver 2.00 as the target platform.
  3. Choose OK to accept the default project properties.
  4. Add a Microsoft CE FileSystem control to the Toolbox or to the project References.
  5. Add the following code in the Sub Main procedure.
    Dim FS As FILECTL.FileSystem
    Dim F As FILECTL.File
    Dim D As String
    Set FS = CreateObject("filectl.filesystem")
    Set F = CreateObject("filectl.file")
    F.Open "\test", 2 'Use 2 instead of fsModeOutput
    D = FS.Dir("*.*")
    F.LinePrint D
    F.Close