How to set a COM Object property to TRUE

How to set a COM Object property to TRUE

am 25.09.2007 22:03:37 von bmw108

Hello,

I am trying to set a WIN32 COM Object bool property true to enable a
validation option.

I can do it in VB like so.

emailPtr.CorrectSyntax = True

How do I do it in PERL?

I have tried so many different things to no avail.

$emailObj->{MxLookup} = (TRUE);
$emailObj->{MxLookup} = $TRUE;
$emailObj->{MxLookup} = 1;
$emailObj->{MxLookup} = TRUE;

Can anyone help?

Re: How to set a COM Object property to TRUE

am 26.09.2007 03:32:06 von Bob Walton

bmw108@gmail.com wrote:
> Hello,
>
> I am trying to set a WIN32 COM Object bool property true to enable a
> validation option.
>
> I can do it in VB like so.
>
> emailPtr.CorrectSyntax = True
>
> How do I do it in PERL?
>
> I have tried so many different things to no avail.
>
> $emailObj->{MxLookup} = (TRUE);
> $emailObj->{MxLookup} = $TRUE;
> $emailObj->{MxLookup} = 1;
> $emailObj->{MxLookup} = TRUE;
>
> Can anyone help?

Maybe [untested]:

$emailObj->{MxLookup} = -1;

?
--
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl

Re: How to set a COM Object property to TRUE

am 26.09.2007 23:25:48 von kevincar

Hi-

On Sep 25, 1:03 pm, bmw...@gmail.com wrote:
> Hello,
>
> I am trying to set a WIN32 COM Object bool property true to enable a
> validation option.
>
> I can do it in VB like so.
>
[---]
>
> Can anyone help?

A little code snippet that works for me;

use strict;
use Win32::OLE;
use Win32::OLE::Variant;
use constant FALSE => Variant( VT_BOOL, 0);
use constant TRUE => Variant( VT_BOOL, 1);

.... and depending upon the COM object's coding, you might have to set
the property like:

$crRpt->Invoke("YOUROBJPROPERYNAME", FALSE);

....or
$crRpt->Options->SetProperty("YOUROBJPROPERYNAME", FALSE);


All the best, HTH

KC

Re: How to set a COM Object property to TRUE

am 03.10.2007 02:05:56 von Jim Carlock

wrote...
: I am trying to set a WIN32 COM Object bool property true to
: enable a validation option.
:
: I can do it in VB like so.
:
: emailPtr.CorrectSyntax = True
:
: How do I do it in PERL?
:
: I have tried so many different things to no avail.
:
: $emailObj->{MxLookup} = (TRUE);
: $emailObj->{MxLookup} = $TRUE;
: $emailObj->{MxLookup} = 1;
: $emailObj->{MxLookup} = TRUE;

Don't know much about how Perl handles 16-bit versus 32-bit,
but the True in VB3/4/5/6 is a 16-bit value and all those
versions of VB handle it as a 16-bit value.

If .CorrectSyntax property is configure as a VB Boolean, it
is 16-bit. If it's configured as a VB Long, it's 32-bit.

Perhaps someone here can comment on the bitness size and let
us know if there's a problem with that?

If the OP has access to the .CorrectSyntax code they might
try to change it to a Long variable and see if it returns the
proper results.

--
Jim Carlock
Swimming Pool, Spa And Water Feature Builders
http://www.aquaticcreationsnc.com/