i've recently started studying com with the intent of writing components
that support ole automation. i could bombard this list with countless
questions (learing com / ole automation is proving to be a worthy challenge)
but this isn't the place for such questions. however, i do have one question
that will pave the way for a lot of progress and save a few hairs from
turning grey....

i've been able to successfully access my first component throuh perl. i can
write methods (in the components interface) that can accept integer
parameters from perl, and return them to perl (in other words, i can write
functions to add numbers and such :) no problem!)

my question, however, is how does perl interact with ole (IDispatch) as far
as strings are concerned. I'm not expecting a long answer... what i would
love to know is what kind of type i can expect to be passed to my function
when i call the "writeStringToFile" function below (i.e. BSTRING, LPBSTRING,
VARIANT, or something else?)

if it matters, i am using ATL to hide a lot of the IDispatch magic from me
:)

#####################
use Win32::OLE;

my $class = "MyFirstATL.myFirstClass.1";
my $myFirstComObject = new Win32::OLE($class) || die "could not open class:
$class";

$myFirstComObject->writeStringToFile("xxx");
print Win32::OLE->LastError() ? Win32::OLE->LastError() : "";
print "error: $!\n" ? $! : "";
#####################

i get a runtime error when i run the above code. what it boils down to is
i'm trying to output a string to a file (as the function name says). i can
write a function "writeStringToFile()" that takes no parameters, and will
write a hard coded string to a file... that's not the problem. the problem
pops up when i try to deal with the string passed to the function. i've
tried assuming it was a BSTRING and initializing a VARIANT and putting the
bstring in it, then using "VariantChangeType" function to change it to a
CHAR* (which is what i would love to have). but no luck (i tried many other
things, but this was my most creative).

Thanks for any help,
ed

---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
         [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
         [EMAIL PROTECTED]

Reply via email to