1. Home
  2. Computing & Technology
  3. Delphi Programming
An Introduction to COM Programming with Delphi (5 / 6)
Page 3: Homework Assignment
 More of this Feature
• Page 1: Marshaling Data. Variant Reference Page.
• Page 2: Using Variants and Variant Arrays
 More Delphi COM Lessons
• TOC
• Lesson 1
• Lesson 2
• Lesson 3
• Lesson 4
• Lesson 6
 Join the Discussion
"Post your views, comments, questions and doubts to this article."
Discuss!
 Related Resources
• COM / OLE / ActiveX programming with Delphi

Delphi encapsulates the entire world of variants into just a handful of functions and procedures, that we've "learned" how to use. To learn even more, here's a homework assignement for you.

Homework Assignment

In this homework assignment, we will need to solidify your understanding of variant arrays. I want you do create an in-process COM server that contains a single com object. This com object has a sing function in it that enumerates the windows using the Windows API and stores the window handle and window class name into a compounded variant array. The client program will be able to make a single function call to the Com Object that returns the variant array. The client will then display the list of window handles followed by its associated class name in a list box.

Homework Summary
To do this assignment, all of the following will probably need to be used:

1) VarArrayLowBound
2) VarArrayHighBound
3) VarIsEmpty
4) VarArrayCreate
5) VarArrayReDim
6) VarArrayOf
7) VarClear
8) GetClassName
9) An EnumWindowsProc called from the EnumWindows Win API function.

Download: the solution to Lesson 5.

First page > Marshaling Data. Variant types. > Page 1, 2, 3

An Introduction to COM Programming with Delphi: Table of Content
<< Previous Lesson (4): A Com Object walk-a-bout. A Class Factory tour. Our first true COM Object program.
>> Last Lesson (6): Let's see how to make your first Type Library using Delphi.

 

Explore Delphi Programming
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Delphi Programming

©2009 About.com, a part of The New York Times Company.

All rights reserved.