Skip to main content

Problem:

This project demonstrates the use of an OLE Automation object that returns a variant.

Resolution:

INTRODUCTION

============

This project demonstrates the use of an OLE Automation object that returns a variant. You can use an object reference as a return type in this case to hold an instance of the OLEVARIANT class. Variant string types will get converted to a character array object so check for that type on the return data.                                                

SOURCE FILES:

=========

Program Files                     Description

----------------------------     -----------------------------------------------------------

variants.app                      Project file

clientprog.cbl                     The main program to run

variantstest.cbl                 The OLE Automation server program

variantstestTrigger.cbl      Trigger program for in-process server

variantstestServer.reg      OLE Automation Sever registry file

Resource Files:

----------------------------     -----------------------------------------------------------

variantstest.rc                   Type library resource file

REQUIREMENTS:

==========

You must first register the variantstest.dll server by editing the variantstestServer.reg file and changing the paths to this dll or by building the project and running "regsvr32 variantstest.dll" from a NetExpress command prompt in the location where the dll resides.

OPERATION:

========

Run the clientprog program. It will pass a string to the server program indicating what type of data to return in a variant. The client program uses code to check the type of data being returned and displays it.

REFERENCES

========

Please see the "Distributed Computing" Programmer's Guide in the Net Express bookshelf, especially the chapter on OLE Data Types.

==========================================================

Keywords: demonstration, sample, example, demo, variant.zip

demo.ex

demo.ne

Attachments:

Variants.zip

Old KB# 4031