Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Microsoft COM Object and PB

6 posts in Objects Last posting was on 2002-11-06 08:38:02.0Z
None Posted on 2002-11-05 03:46:14.0Z
Newsgroups: sybase.public.powerbuilder.objects
From: "None" <tbrackney@kc.rr.com>
Subject: Microsoft COM Object and PB
Date: Mon, 4 Nov 2002 19:46:14 -0800
Lines: 8
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: mkc-65-26-8-203.kc.rr.com 65.26.8.203
Message-ID: <364_XqI3g9GhCHA.249@forums.sybase.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.powerbuilder.objects:803
Article PK: 713370

Has anyone tried to access a collections object from a VB COM from
Powerbuilder? If so, do you access it as if it was an array or is there
another approach.

Thanks
Tom


De Permentier Davy Posted on 2002-11-05 08:17:45.0Z
Newsgroups: sybase.public.powerbuilder.objects
From: "De Permentier Davy" <no_spam@my.adress>
Subject: Re: Microsoft COM Object and PB
Date: Tue, 5 Nov 2002 09:17:45 +0100
Lines: 24
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4807.1700
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700
NNTP-Posting-Host: 193.190.121.69
Message-ID: <364_oUG1yVKhCHA.196@forums.sybase.com>
References: <364_XqI3g9GhCHA.249@forums.sybase.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.powerbuilder.objects:802
Article PK: 713366

Hey,

It depends... If the Collections object from VB is not a PowerBuilder
DataType, you acces it directly like this :

My_OleObject.Application.Documents(1).Activate

I'm not 100% sure if you use ( or [

HTH,
Davy

"None" <tbrackney@kc.rr.com> wrote in message
news:XqI3g9GhCHA.249@forums.sybase.com...
> Has anyone tried to access a collections object from a VB COM from
> Powerbuilder? If so, do you access it as if it was an array or is there
> another approach.
>
> Thanks
> Tom
>
>


Tom Posted on 2002-11-05 14:48:04.0Z
Newsgroups: sybase.public.powerbuilder.objects
From: Tom
Date: Tue, 5 Nov 2002 09:48:04 -0500
Subject: Re: Microsoft COM Object and PB
Lines: 21
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Message-ID: <364_A8EE9F08A081D8C100514E3485256C68.00319F3885256C68@webforums>
References: <364_XqI3g9GhCHA.249@forums.sybase.com> <364_oUG1yVKhCHA.196@forums.sybase.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com!webforums.sybase.com!news
Xref: forums-1-dub sybase.public.powerbuilder.objects:800
Article PK: 713365

Not sure what you mean Davy. I'll explain. The VB COM has a number of
collections. Some are integer and some string.

How do I access each element in the collection? The com is called
ff_ole.dll. Here is how I am declaring it.

OLEObject FF_OLE
FF_OLE = CREATE OLEObejct

li_rtn = FF_OLE.ConnectToNewObject("FF_OLE.Security")

The above works.

I can run the methods in the object.

I Cannot seem to access the properties which are collections.

Anyone's help is most appricative. I have tried treating it like an array
but I keep getting an invalid number of subscripts error.

Tom


De Permentier Davy Posted on 2002-11-05 16:34:05.0Z
Newsgroups: sybase.public.powerbuilder.objects
From: "De Permentier Davy" <no_spam@my.adress>
Subject: Re: Microsoft COM Object and PB
Date: Tue, 5 Nov 2002 17:34:05 +0100
Lines: 48
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4807.1700
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700
NNTP-Posting-Host: 193.190.121.69
Message-ID: <364_7CspJrOhCHA.196@forums.sybase.com>
References: <364_XqI3g9GhCHA.249@forums.sybase.com> <364_oUG1yVKhCHA.196@forums.sybase.com> <364_A8EE9F08A081D8C100514E3485256C68.00319F3885256C68@webforums>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.powerbuilder.objects:799
Article PK: 713363

Hey Tom,

I'll explain the example...

My_OleObject.Application.Documents(1).Activate = Call the activate method
for the first document in the documents collection

My_OleObject = The dll or application you are connected to via OLE
automation (in this example it's MsWord)

Application.Documents = The MsWord application has a collections object that
is called "Documents". And in MsWord you can acces that collections object
thrue the application object. The Documents collections object contains all
opened MsWord documents.

So I don't know how your VB component is written but if the collections
object you need is directly accesable (ask the person who wrote the VB
component) it should be something like this :
FF_OLE.collectionsobject(n) or FF_OLE.Application.collectionsobject(n)

HTH,
Davy

<Tom> wrote in message
news:A8EE9F08A081D8C100514E3485256C68.00319F3885256C68@webforums...
> Not sure what you mean Davy. I'll explain. The VB COM has a number of
> collections. Some are integer and some string.
>
> How do I access each element in the collection? The com is called
> ff_ole.dll. Here is how I am declaring it.
>
> OLEObject FF_OLE
> FF_OLE = CREATE OLEObejct
>
> li_rtn = FF_OLE.ConnectToNewObject("FF_OLE.Security")
>
> The above works.
>
> I can run the methods in the object.
>
> I Cannot seem to access the properties which are collections.
>
> Anyone's help is most appricative. I have tried treating it like an array
> but I keep getting an invalid number of subscripts error.
>
> Tom


Tom Posted on 2002-11-05 17:35:34.0Z
Newsgroups: sybase.public.powerbuilder.objects
From: Tom
Date: Tue, 5 Nov 2002 12:35:34 -0500
Subject: Re: Microsoft COM Object and PB
Lines: 35
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Message-ID: <364_9A79EE814D7EAB770060A3D485256C68.005EF50885256C68@webforums>
References: <364_XqI3g9GhCHA.249@forums.sybase.com> <364_oUG1yVKhCHA.196@forums.sybase.com> <364_A8EE9F08A081D8C100514E3485256C68.00319F3885256C68@webforums> <364_7CspJrOhCHA.196@forums.sybase.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com!webforums.sybase.com!news
Xref: forums-1-dub sybase.public.powerbuilder.objects:798
Article PK: 713361

Hi Davy,
Thanks for your help. One more question. How would I store the value from
the collection object. Below is the vbs script you would use if accessing
the COM through vbs. But I will be doing it through PB.

Dim oTest

Set oTest = CreateObject("FF_OLE.Security")
MsgBox oTest.Return5 //method to return a number

oTest.FillCollection //method that populates the collection

For Each str in oTest.MyCollection
MsgBox str
Next

'
' Just Add stuff to collection
'
Dim oTest2
Set oTest2 = CreateObject("FF_OLE.Security")

oTest2.MyCollection.Add("zebra")
oTest2.MyCollection.Add("lion")
oTest2.MyCollection.Add("worm")

For Each str in oTest2.MyCollection
MsgBox str
Next


Set oTest = Nothing
Set oTest2 = Nothing


De Permentier Davy Posted on 2002-11-06 08:38:02.0Z
Newsgroups: sybase.public.powerbuilder.objects
From: "De Permentier Davy" <no_spam@my.adress>
Subject: Re: Microsoft COM Object and PB
Date: Wed, 6 Nov 2002 09:38:02 +0100
Lines: 77
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4807.1700
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700
NNTP-Posting-Host: 193.190.121.69
Message-ID: <364_vL4XEHXhCHA.249@forums.sybase.com>
References: <364_XqI3g9GhCHA.249@forums.sybase.com> <364_oUG1yVKhCHA.196@forums.sybase.com> <364_A8EE9F08A081D8C100514E3485256C68.00319F3885256C68@webforums> <364_7CspJrOhCHA.196@forums.sybase.com> <364_9A79EE814D7EAB770060A3D485256C68.005EF50885256C68@webforums>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.powerbuilder.objects:795
Article PK: 713357

Hey Tom,

If the collections object (MyCollection in your example) is of DataType
collections in VB, you'll have to catch it in another OleObject in Pb.
Because Pb doesn't have a DataType that is like the collections object. For
example :

lnv_word = create oleobject
lnv_doc = create oleobject
lnv_word.ConnectToNewObject('Word.Application.9')
lnv_doc = lnv_word.Application.Documents.open(ls_document_pathname)

In this example I have two OleObjects. One that is connected to the word
application and another which contains the word document. Because Pb doesn't
have a "Document" DataType, so you have to use an OleObject.

In your case it may not be nescessary to have the entire collection object
in your application. So what you could try to do is the following in your
script:

Any la_value

My_OleObject.ConnectToNewObject(FF_OLE.Security)
My_OleObject.FillCollection
//Or if this method also returns the Collections object, you could use :
//My_OleObject_2 = My_OleObject.FillCollection

la_value = My_OleObject.MyCollection(1) //This depends on how you acces the
value in VB
//Or My_OleObject_2.SomeThing

Ask the VB programmer how he accesses 1 value of the collections object
(like we would acces an array in Pb for example: ls_value = array[1]). That
should give you a clue.

HTH,
Davy

<Tom> wrote in message
news:9A79EE814D7EAB770060A3D485256C68.005EF50885256C68@webforums...
> Hi Davy,
> Thanks for your help. One more question. How would I store the value from
> the collection object. Below is the vbs script you would use if accessing
> the COM through vbs. But I will be doing it through PB.
>
> Dim oTest
>
> Set oTest = CreateObject("FF_OLE.Security")
> MsgBox oTest.Return5 //method to return a number
>
> oTest.FillCollection //method that populates the collection
>
> For Each str in oTest.MyCollection
> MsgBox str
> Next
>
> '
> ' Just Add stuff to collection
> '
> Dim oTest2
> Set oTest2 = CreateObject("FF_OLE.Security")
>
> oTest2.MyCollection.Add("zebra")
> oTest2.MyCollection.Add("lion")
> oTest2.MyCollection.Add("worm")
>
> For Each str in oTest2.MyCollection
> MsgBox str
> Next
>
>
> Set oTest = Nothing
> Set oTest2 = Nothing
>
>