[fpc-pascal]Windows unit Examples

Gabor DEAK JAHN djg at tramontana.co.hu
Fri Aug 17 20:45:42 CEST 2001

At 8/16/01 01:52 PM, you wrote:

Dear Friend,

 > My isp has a web front end for email.. it doesn't allow you to change the
 > name !! :( I've grown to accept it...

Actually, a viable solution would be then to sign your letters with your
name, then we could know who we are responding to... :-))

 > poster was after. It's only a solution if you truely understand how the 
 > com/ole mechanism works to quite a low level. I would *not* call
 > it 'supporting' OLE Automation. After all I could instanciate and use C++

Partly you're right, a more elegant solution would be much better, although
you can delegate most of the functionality into a separate unit (I sent such
a unit to Michael in the meantime). If you use a unit like that, maybe
coming bundled with the compiler later, you don't have to worry about the
low level details yourself.

And you should also note that all OLE methods have an associated dispatch ID
(a unique number) and should be invoked using this ID. There is, however, two
ways to achieve this: either you use the string name of the method and
query the actual ID from the COM interface every time you call that
particular function or you create your wrapper procedures and functions
beforehand, hardwire the IDs and the parameter passing and then use these
wrapper functions from your program (these routines already have nothing
COM-like about them, you can call them just like any other proc/func in your

The second solution is much more efficient, doing away with an extra call and
some string manipulation for each and every call you make. However, a
universally automatic solution like in Visual Basic cannot use this second
approach, only the first one. Thus, if you prefer that kind of a solution,
you might spare some work but will end up with a much less efficient solution.

Actually, using my unit as it is know requires of you nothing more than to
write exactly those wrapper procedures and functions which make up this
second approach. And you would need to write them anyway, for the sake of
efficiency, even if FPC offered the most automatic integration with OLE that
can be dreamt of.


Gabor DEAK JAHN -- Budapest, Hungary.
E-mail: djg at tramontana.co.hu

More information about the fpc-pascal mailing list