Novell is now a part of Micro Focus

Programming with the Novell Controls for ActiveX and Visual Basic: Getting Started

Articles and Tips: article

MORGAN B. ADAIR
Software Engineer
Developer Information

01 Jun 1999


This lesson is the first in a series of lessons that will show how to develop programs that use Novell Directory Services (NDS) using Microsoft's Visual Basic and the Novell Controls for ActiveX.

Introduction

This lesson is the first in a series of lessons that will show how to develop programs that use Novell Directory Services (NDS) using Microsoft Visual Basic and the Novell Controls for ActiveX. These lessons will appear on the DeveloperNet University Web page at http://developer.novell.com/education/.

The Novell Controls for ActiveX enable you to quickly and easily develop applications that use NetWare services, including Novell Directory Services (NDS), print, login, LDAP services, and volume administration. You can use these controls in any IDE (Integrated Development Environment) that supports ActiveX technology, including Visual Basic, Delphi, PowerBuilder, and C++ development environments. In this lesson, we'll focus on using the Novell Controls in the Visual Basic environment. We'll cover:

  • Setting up your development environment

  • Downloading and installing the Novell Controls for ActiveX

  • An overview of the controls

  • A simple program that uses the controls

  • Where to find documentation and example code


Objective

Using this lesson as a guide, a Visual Basic Programmer will be able to begin writing programs using the Novell Controls for ActiveX.

Prerequisite

Entry-level Visual Basic programming skills, a DeveloperNet subscription (Electronic Level subscription available free at http://developer.novell.com).

Required Items

A Win 32 workstation (Windows 85/98/NT), Microsoft's Visual Basic or Visual Studio, a NetWare 4 or 5 server.

Optional

None.

Required Setup

None.

Development Environment

The procedures discussed in this lesson were tested using a 200 MHZ Pentium-based workstation with 64 MB RAM, running Windows NT 4.0, a NetWare 4.11 file server, the NetWare Client for NT 4.60, Microsoft Visual Studio 6.0, and the Novell Controls for ActiveX 1/25/99.

Setting Up Your Development Environment

How you should configure your development environment depends partly on what type of applications you plan to develop. Most developers who use Visual Basic and ActiveX develop applications that can be categorized as access-controlled or access-controlling.

Access-controlled

The application only uses network resources that have been granted to the user, and which can be administered through existing network management utilities, such as NWAdmin and ConsoleOne. Applications of this type can be developed on a workstation attached to NetWare servers on your corporate network.

Figure 1: Access-controlled.

Access-controlling

The application grants access to network resources. Network management utilities and applications that need to create new NDS objects fit into this model. To develop applications of this type, you should have a NetWare development server with its own NDS tree, separate from your corporate tree.

Figure 2: Access-controlling.

[Digression alert!] Access-controlling applications can be further categorized as single-server and distributed applications. Single-server applications provide identical services from every server they are installed on. Distributed applications provide services that can be partitioned asymmetrically, that is, with different services provided by at least two servers in the network. When developing distributed applications, you must have multiple servers in your development tree. But since Visual Basic and ActiveX are focused on client-side application development, we'll assume that a single development server will be sufficient. [End digression]

To develop network applications using the Novell Controls for ActiveX, you will need at least:

  • A PC with a 486 or Pentium processor; Pentium 90 MHZ or better recommended.

  • 24 MB RAM, 32 MB or more recommended.

  • 200 MB available hard disk space for Visual Basic, Internet Explorer, the Microsoft Developer Net work (MSDN) tools, the Novell Client, and the Novell Controls for ActiveX.

  • Microsoft Mouse or compatible pointing device.

  • A CD-ROM drive.

  • VGA or higher resolution monitor, Super-VGA or higher recommended.

  • Windows 95, Windows 98, or Windows NT 4.0 with Service Pack 3 or later.

  • The appropriate Novell Client for your operating system (see http://www.novell.com/download/).

  • Microsoft Visual Basic version 5 or 6, or Visual Studio version 5 or 6.

  • A server running NetWare 4.11 or 5.

Disk space requirements vary considerably, depending on which edition of Visual Basic or Visual Studio you use and which tools you install. See Microsoft's Web site for more detailed requirements (http://www.microsoft.com/products/develop.htm).

To set up your development workstation, perform the following steps:

  1. Set up the workstation hardware and connect the workstation to the network.

  2. Install the version of Windows you plan to use (if it is not installed already). If you are using Windows NT 4.0, verify that Service Pack 3 or later is installed.

  3. Install the appropriate Novell Client for your operating system. Novell clients can be downloaded free at http://www.novell.com/download/.

  4. Install Visual Basic or Visual Studio (the Visual Basic and Visual Studio installation programs also install Internet Explorer and the MSDN tools).

  5. Following the instructions in the next section, download and install the Novell Controls for ActiveX.

Consult the documentation for each of the components listed above for detailed installation instructions.

Installing the Novell Controls for ActiveX

You can download the Novell Controls for ActiveX from the DeveloperNet Web page: http://developer.novell.com/ndk. If you have an older version of the controls installed on your computer, you should run the UNREGOCX.BAT batch program that came with the controls to remove references to them from the Windows Registry, then use "Add/Remove Programs" in the Windows Control Panel to remove the older version of the controls before installing the latest version.

The install program for the Novell Controls for ActiveX is called OCX.EXE, and uses the familiar InstallShield interface. You should probably install the controls in a directory on your workstation's hard drive (not a network drive). If the controls are on a local drive, the controls will be available for your programs to use before you are logged in to NDS. You can use the Session control, for example, to develop a custom login interface if the control is installed on the workstation's local hard drive.

The Novell Controls install program puts the controls into the directory you specify (default name, ActiveX). In this directory, there is a batch program called REGOCX.BAT, which you should run to register the Novell Controls.

You can verify that the Novell Controls have been installed and registered correctly by doing the following.

  1. Run Visual Basic.

  2. Select "Components" from the Project Menu.

  3. Scroll down the list of controls displayed in the Components dialog box and verify that the 11 Novell controls are in the list (see Figure 3).

Figure 3: Novell Controls in the Visual Basic components list.

An Overview of the Controls

There are 11 controls included in the Novell Controls for ActiveX. A brief description of each of the controls follows. Future lessons in this series will focus on the controls used for NDS programming, the Directory and Session controls.

Application Administration

The Application Administration Control provides features to set up and manage the Application Management and Distribution features in Z.E.N.works. It installs new applications and updates existing applications with personalized information stored in the directory.

Bindery

The Bindery Control accesses the NetWare Bindery to manage backup, search, and restore functions on a server and administrates network entries (users, groups, printers). It also lets you add a new entry class (a layout) and describe the Bindery field.

Directory

The Directory Control accesses Novell Directory Services (NDS), allowing you to add, delete, search, and manage directory entries, and extend and manage the Directory schema. It allows you to easily access, add, delete, view or modify NDS trees.

Internet Directory

The Internet Directory Control allows you to create network applications that access the Lightweight Directory Access Protocol (LDAP), a protocol for accessing Internet directory services.

Print Queue Administration

The Print Queue Administration Control provides features to manage NetWare print queues, including properties to view and manage print jobs, set update intervals, and display the print job status.

Print Server Administration

The Print Server Administration Control is used to set up and control a print server and its associated printers from a remote workstation.

Session

The Session Control abstracts features of a network session, allowing you to log in using the NetWare Client32 dialog box, list current drive maps, and run user-specific login scripts.

Server Socket and Client Socket

The Server Socket and Client Socket controls let you design applications that communicate using either TCP or SPX protocols, allowing you to integrate low-level communication functionality into your applications.

Server Administration

The Server Administration Control provides features to manage NetWare servers. It contains properties and methods to view or edit primary server parameters and feature settings.

Volume Administration

The Volume Administration Control provides features to manage a NetWare volume, letting you view and modify volume information (disk space, namespaces, modification dates), and manage directories and files.

Example Program

Follow the steps below to write a simple program, using the Novell Controls for ActiveX, that displays the full name of your user object in the NDS tree, the name of the NDS tree you are logged in to, and your user object's context in the tree.

  1. Start Visual Basic and create a new "Standard EXE" project.

  2. Select "Components" from the Project menu, scroll down the list of available components, check the box next to "Novell Directory Control" and click on the OK button.

  3. Click on the Directory control's tree icon in the toolbox and add an instance of the Directory control to your project's form (see Figure 4 below).

    Figure 4: Using the Directory Control in a Visual Basic Program.

  4. Place 6 label controls on form as shown in Figure 2. Change the captions on the 3 label controls on the left side of the form to "You are:", "Logged into tree:", and "At context:" as shown in the figure. Name the three labels on the right side of the form LoginNameLbl, TreeNameLbl, and ContextLbl.

  5. Double-click on the project's main form to edit the form's Form_Load subroutine. Add the following lines to the subroutine:

    LoginNameLbl.Caption = NWDir1.LoginName
    
    TreeNameLbl.Caption = NWDir1.TreeFromFullName(NWDir1.FullName)
    
    ContextLbl.Caption = NWDir1.ContextFromFullName(NWDir1.FullName)
  6. Change the form's caption to "Who am I?"

  7. Make sure that you are logged into an NDS tree, then select "Start" from the Run Menu to execute the program.

The program displays the full name of your user object in the NDS tree, the tree name, and context. It should look something like Figure 5.

Figure 5: Who am I? example program.

Further Information

Online documentation in Windows Help format is installed with the ActiveX controls. More complete documentation is available on the Web at:

http://developer.novell.com/ndk/doc.htm

DeveloperNet also has sample code for each of the Novell controls that can be downloaded from:

http://developer.novell.com/ndk/sample.htm

Novell Press recently published a book that illustrates how to do NDS programming using a variety of development tools, including Visual Basic and Delphi with the Novell Controls for ActiveX. The book is:

Novell's NDS Developer's Guide 700 pages Includes CD-ROM ISBN: 0-7645-4557-4

For more information on the book, see:

http://developer.novell.com/nds/devguide.htm

And stay tuned to Novell Developer Notes and DeveloperNet University (http://developer.novell.com/education) for more lessons in this series.

* Originally published in Novell AppNotes


Disclaimer

The origin of this information may be internal or external to Novell. While Novell makes all reasonable efforts to verify this information, Novell does not make explicit or implied claims to its validity.

© Copyright Micro Focus or one of its affiliates