PB 6.0, VB 5.0 and COM Interface Question

I am new to the PowerBuilder world. I have a very simple VB 5.0 OLE server.
The code looks like the following:

Class: CDog

Option Explicit

Implements IAnimal

Private Sub IAnimal_Bite()
  MsgBox "The dog bit me."
End Sub

Private Sub IAnimal_Move()
  MsgBox "The dog is running."
End Sub

Class: CFlea

Option Explicit

Implements IAnimal

Private Sub IAnimal_Bite()
  MsgBox "The flea bit me."
End Sub

Private Sub IAnimal_Move()
  MsgBox "The flea is flying."
End Sub

Class: IAnimal

Option Explicit

Public Sub Bite()

End Sub

Public Sub Move()

End Sub

Module: Main

Option Explicit

Public Sub Main()
  Dim x As CDog
  Dim y As CFlea
  Dim z As IAnimal

  Set x = New CDog

  Set y = New CFlea

  Set z = x
  z.Bite

  Set z = y
  z.Bite

  Set z = Nothing
  Set x = Nothing
  Set y = Nothing
End Sub

In the main module, when z.Bite occurs the first time, a message box
displays "The dog bit me." The second time z.Bite is called, a message box
displays "The flea bit me." This works the way I want it to in VB 5.0. So I
wanted to have this funtionality work in PB 6.0 in a similar fashion.
However, I do not know how to do this. The following code snippet is what I
have so far in the click event of a button:

integer li_result
OLEObject obj_dog
OLEObject obj_animal

obj_dog = CREATE OLEObject
li_result = obj_dog.ConnectToNewObject("Interfaces.CDog")
if li_result = 0 then
  // Somehow need to set animal to dog so that I can access the Bite
function. HOW ???
  obj_animal.Bite()
  end if
end if

DESTROY obj_dog
DESTROY obj_animal



How do I call the Bite method that is part of the Animal Interface??

Jonathan





0
Jonathan
6/4/1998 1:41:58 PM
sybase.ole-ocx-activex 6324 articles. 0 followers. Follow

2 Replies
410 Views

Similar Articles

[PageSpeed] 9

Jonathan,

unfortunately you can't. PB works with COM objects in late-bind mode, and in
such mode you can't access the object's "secondary" interfaces (all those
"implement"ed).
Maybe you can try changing the "secondary" methods (IAnimal_Bite,
IAnimal_Move, ...) from Private to Public but then you must call them with
the "full" name: obj_dog.IAnimal_Bite().
I'm not sure that this will work completely correctly and furthermore I
don't know how much this is correct from a COM point of view.

regards,
-----------------------------------------------------
 Stefano Scheda
 Gruppo Formula SpA
 Bologna, ITALY
 e-mail: stefano.scheda@formula.it
-----------------------------------------------------

Jonathan Ominsky wrote in message ...
>I am new to the PowerBuilder world. I have a very simple VB 5.0 OLE server.
>The code looks like the following:
>
>Class: CDog
>
>Option Explicit
>
>Implements IAnimal
>
>Private Sub IAnimal_Bite()
>  MsgBox "The dog bit me."
>End Sub
>
>Private Sub IAnimal_Move()
>  MsgBox "The dog is running."
>End Sub
>
>Class: CFlea
>
>Option Explicit
>
>Implements IAnimal
>
>Private Sub IAnimal_Bite()
>  MsgBox "The flea bit me."
>End Sub
>
>Private Sub IAnimal_Move()
>  MsgBox "The flea is flying."
>End Sub
>
>Class: IAnimal
>
>Option Explicit
>
>Public Sub Bite()
>
>End Sub
>
>Public Sub Move()
>
>End Sub
>
>Module: Main
>
>Option Explicit
>
>Public Sub Main()
>  Dim x As CDog
>  Dim y As CFlea
>  Dim z As IAnimal
>
>  Set x = New CDog
>
>  Set y = New CFlea
>
>  Set z = x
>  z.Bite
>
>  Set z = y
>  z.Bite
>
>  Set z = Nothing
>  Set x = Nothing
>  Set y = Nothing
>End Sub
>
>In the main module, when z.Bite occurs the first time, a message box
>displays "The dog bit me." The second time z.Bite is called, a message box
>displays "The flea bit me." This works the way I want it to in VB 5.0. So I
>wanted to have this funtionality work in PB 6.0 in a similar fashion.
>However, I do not know how to do this. The following code snippet is what I
>have so far in the click event of a button:
>
>integer li_result
>OLEObject obj_dog
>OLEObject obj_animal
>
>obj_dog = CREATE OLEObject
>li_result = obj_dog.ConnectToNewObject("Interfaces.CDog")
>if li_result = 0 then
>  // Somehow need to set animal to dog so that I can access the Bite
>function. HOW ???
>  obj_animal.Bite()
>  end if
>end if
>
>DESTROY obj_dog
>DESTROY obj_animal
>
>
>
>How do I call the Bite method that is part of the Animal Interface??
>
>Jonathan



begin 666 Stefano Scheda.vcf
M0D5'24XZ5D-!4D0-"E9%4E-)3TXZ,BXQ#0I..E-C:&5D83M3=&5F86YO#0I&
M3CI3=&5F86YO(%-C:&5D80T*3U)'.D=R=7!P;R!&;W)M=6QA.U(F1 T*5$E4
M3$4Z4B9$($UA;F%G97(-"D%$4CM73U)+.CL[5FEA($UA='1E;W1T:2 U.U9I
M;&QA;F]V82!D:2!#87-T96YA<V\[0F]L;V=N83LT,# U,#M)=&%L>0T*3$%"
M14P[5T]22SM%3D-/1$E.1SU154]4140M4%))3E1!0DQ%.E9I82!-871T96]T
M=&D@-3TP1#TP059I;&QA;F]V82!D:2!#87-T96YA<V\L($)O;&]G;F$@-# P
M-3 ],$0],$%)=&%L>0T*55),.@T*55),.FAT=' Z+R]W=W<N9F]R;75L82YI
M= T*14U!24P[4%)%1CM)3E1%4DY%5#IS=&5F86YO+G-C:&5D84!F;W)M=6QA
F+FET#0I2158Z,3DY.# V,#14,38U-C4P6@T*14Y$.E9#05)$#0H`
`
end

0
Stefano
6/4/1998 4:56:50 PM
Hi,

try :
obj_animal.Object.Bite()

Regards

Jonathan Ominsky <ominskja@iscg.com> a �crit dans l'article
<uamPIU7j9GA.107@forums.powersoft.com>...
> I am new to the PowerBuilder world. I have a very simple VB 5.0 OLE
server.
> The code looks like the following:
> 
> Class: CDog
> 
> Option Explicit
> 
> Implements IAnimal
> 
> Private Sub IAnimal_Bite()
>   MsgBox "The dog bit me."
> End Sub
> 
> Private Sub IAnimal_Move()
>   MsgBox "The dog is running."
> End Sub
> 
> Class: CFlea
> 
> Option Explicit
> 
> Implements IAnimal
> 
> Private Sub IAnimal_Bite()
>   MsgBox "The flea bit me."
> End Sub
> 
> Private Sub IAnimal_Move()
>   MsgBox "The flea is flying."
> End Sub
> 
> Class: IAnimal
> 
> Option Explicit
> 
> Public Sub Bite()
> 
> End Sub
> 
> Public Sub Move()
> 
> End Sub
> 
> Module: Main
> 
> Option Explicit
> 
> Public Sub Main()
>   Dim x As CDog
>   Dim y As CFlea
>   Dim z As IAnimal
> 
>   Set x = New CDog
> 
>   Set y = New CFlea
> 
>   Set z = x
>   z.Bite
> 
>   Set z = y
>   z.Bite
> 
>   Set z = Nothing
>   Set x = Nothing
>   Set y = Nothing
> End Sub
> 
> In the main module, when z.Bite occurs the first time, a message box
> displays "The dog bit me." The second time z.Bite is called, a message
box
> displays "The flea bit me." This works the way I want it to in VB 5.0. So
I
> wanted to have this funtionality work in PB 6.0 in a similar fashion.
> However, I do not know how to do this. The following code snippet is what
I
> have so far in the click event of a button:
> 
> integer li_result
> OLEObject obj_dog
> OLEObject obj_animal
> 
> obj_dog = CREATE OLEObject
> li_result = obj_dog.ConnectToNewObject("Interfaces.CDog")
> if li_result = 0 then
>   // Somehow need to set animal to dog so that I can access the Bite
> function. HOW ???
>   obj_animal.Bite()
>   end if
> end if
> 
> DESTROY obj_dog
> DESTROY obj_animal
> 
> 
> 
> How do I call the Bite method that is part of the Animal Interface??
> 
> Jonathan
> 
> 
> 
> 
> 
> 
0
Raynald
6/5/1998 5:48:49 AM
Reply:

Similar Artilces:

VB 5.0-based ActiveX control in PB 6.0 (build 189)
Has anyone had luck using a VB 5.0-generated ActiveX control into a PB 6.0 (build 189) window? Even simple VB-based ActiveX controls (e.g., a label control) choke, even when simply being placed on a window (error hex 80004005). Same problem when the window is opened from the library painter. When the window runs, I get a PB run-time error 445 (object doesn't support this action), even though my PB app makes NO calls to the ActiveX. Any ideas? thanks, nurk. -- Tom Nurkkala, PhD tom.nurkkala@powercerv.com ...

migrating from pb 5.0 -> pb 6.0/6.5 any pothole
I am looking for any know potholes to avoid in migrating several PB 5.0 application to PB 6.0/6.5 using an Oracle 7.3 data base on Win 95 client? Thanks Brian, Take a look at http://techinfo.sybase.com/css/techinfo.nsf/DocID/ID=47787 Also, do your own search on 'mirgrating' and you should come up with a few other references. Frank Brian Scanlon wrote in message <01be37fa$0aa527a0$4e4b8282@bscanlon.cdphp.com>... >I am looking for any know potholes to avoid in migrating several PB 5.0 >application to PB 6.0/6.5 >using an Oracle 7.3 data base on Win ...

Bugfixes for PB 6.0? Back from 6.0 to 5.0?
Hi there, since there are so many troubles with PB 6.0, does anyone know if there are any bugfixes for PB 6.0 out yet or even planned for the NEAR future? Is there a way to migrate back from PB 6.0 to PB 5.0.0x? Regards, * gerald * You sound pretty upset - if you don't mind me asking what are these troubles you are having? Gerald Znidaric wrote in message <34C86F5A.778A0197@mgm-edv.de>... >Hi there, > >since there are so many troubles with PB 6.0, does anyone know if there >are any bugfixes for PB 6.0 out yet or even planned for the NEAR future? ...

PB 7.0 or PB 6.5 or PB 6.0 or PB5.04
We are using PB 5.04 Enterprise at this moment and are almost happy (uch) with it. Because we don't programming applications for the Internet (maybe in the near future) we haven't upgraded to version 6.0 and 6.5. Now we are confused what to do, keeping the old and 'stable' version (5.04) or upgrading to a newer version. Are there features in the newer versions wich make it a 'must' to upgrade. What are this features. Or are there reasons to stay on 5.04 (buggy newer versions?). What is doing the rest of the Powerbuilder world??? Greetings, Hans Groeneveld ...

Can PB 5.0, 6.0, and 6.5 Coexist
I currently support a couple of PB5.0 applications and I am looking to upgrade them to PB 6 or 6.5. I read the 6.5 documentation that said you need to remove all previous versions of PB before installing. I would like to have 5.0 and 6.0 or 6.5 coexist so that I can still support the old application while I work the 6.5 to learn and study the upgrade. So, can they co-exist and what problems might I run into? Thanks , Doug I have PB5 16-bit, (5.03), PB5 32-bit (PB5.04), PB6.5 and PB7 on the same machine - They live in different worlds. Make sure you keep backups of code and main...

Running PB 3.0, 4.0, 5.0 and 6.0 on same PC
I am attempting to run PowerBuilder 3, 4, 5 (both 16 and 32 bit), and 6 on the same PC. I know that sounds crazy but all of those releases are still in use at my company. The only problem I am having is I can't get 6.0 to use its own pb.ini file. I am running NT 4.0 and have made the following entries in my WIN.INI in the [Powerbuilder] section: INITPATH=c:\...... statement for PB3, INITPATH040 for PB4, INITPATH050 for PB5, and INITPATH060 for PB6. This method works for PB3, 4, and 5 but not 6. PB6 seems to be using the INITPATH statement but ignores the INITPATH060 statement. M...

PB 5.0 to PB 6.5, 7.x, 8.0??
I have a client who needs to move from an initial PB 5.0 release (no patches applied) to a newer version of PB. This is a small internal application but they would like to open it up via the internet in the future. They are currently running on a SQL Anywhere DB but would be looking to change that also. I don't have any hands on experience with PB 7.x but from what I heard and read it hasn't been that great. I've been using PB 6.5 since build 444 and was thinking of recommending that they make the move to 6.5 first and then wait for PB 8.0 later this year. Any thoug...

Connection of PB 6.0 to SQL Server 7.0 & Version B/W PB 6.0 and PB 7.0
Can anyone tell me about connecting PB 6.0 to SQL Server 7.0. Please remember we are not planning to upgrade both software. When I was trying to connect PB 6.0 to SQL Server 7.0, error occurred " SQLSTAT 1003". OS=NT 4.0 Server PB=6.0 Enterprise Edition SQL SERVER=7.0 Corporate Edition I also want to know the versions between PB 6.0 to PB 7.0 If your are using the ODBC, which I assume you are, include Disablebind=1 in your DBParm. If your deployment environment is also NT, you will have to turn SQLSPY=1 using PFC services. Autocommit=FALSE and SetTransObject() ra...

Help me about connecting PB 6.0 to SQL Server 7.0 & Versions B/W PB 6.0 and PB 7.0
Can anyone tell me about connecting PB 6.0 to SQL Server 7.0. Please remember we are not planning to upgrade both software. When I was trying to connect PB 6.0 to SQL Server 7.0, error occurred " SQLSTAT 1003". OS=NT 4.0 Server PB=6.0 Enterprise Edition SQL SERVER=7.0 Corporate Edition I also want to know the versions between PB 6.0 to PB 7.0 I don't believe this is going to be possible without at least upgrading to the latest maintenance release of 6.x. On Mon, 23 Aug 1999 00:59:56 -0700, in powersoft.public.powerbuilder.database Abdul Lateef <abdul_lat...

Netware 5.0+Groupwise 6.0 -->> Netware 6.0+Groupwise 6.5
Hi. We've got a Netware 5.0 server running Groupwise 6.0 and we would like to upgrade it to Netware 6.0 with Groupwise 6.5. What's the safest way of doing this? We've got a spare server where we can dump things temporarily. Should we upgrade Groupwise first or Netware? Thanks... Scott Le Brun Computer Operations Co-ordinator Mount Scopus Memorial College slebrun@no-spam.scopus.vic.edu.au: > Should we upgrade Groupwise first or Netware? Personally, I'd upgrade Netware first, make sure GW works in it's current config and then upgrade GW....

Upgrading 4.0 to 5.0 then 6.0 or go straight to 6.0
Hi All, I think the subject speaks for itself Thanks in advance Mustafa You should have no trouble going straight to 6 from 4. Once you do this, go back and get rid of the obsolete function calls. -- Regards, Millard[TeamPowersoft] -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ mf3@gatesys.com Co-Author of PowerBuilder 5.0: Object Oriented Design and Development McGraw-Hill, ISBN 0-07-024469-3 Co-Author of PFC Professional Reference (Block, Brown, Gasin, Green & Tauber) McGraw-Hill, 0-07-913267-7 -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+...

pb 6.5, pb 7.0, pb 8.0 and future releases
I have designed an app using PB 6.5.1 and feel quite confortable to write another app using this version of Power Buulder. I am aware that there have been many other releases after this but have heard many developers complain about not being stable and so forth. I can't say how true this is cause I never bothered to update to later releases. I recently got a contract for a new app and quite likely will be using Power Biulder but I am wondering if am cheating myself by not trying to upgrade myself to a later release of Power Biulder. Thanks. Charlie. Charlie You...

Firefox 2.0.0.6 Reverts back to 2.0.0.5 reinstalls 2.0.0.6, wipes out user settings
Firefox is turning into a piece of crap. First, there is only 1 profile, the default profile. Second, after the first 2.0.0.6 update wiped out the profile settings (again), the automatic check for updates was turned off. This morning the customized profile settings went MIA again, Firefox decided it was version 2.0.0.5 (per the help, about firefox) and automatically downloaded 2.0.0.6; even though 2.0.0.6 had already been installed on July 31. It now thinks it is 2.0.0.6, the home page and other profile settings have been reset, and automatic updates turned off for everyt...

Running PB 6.0 and PB 5.0 on Same Machine
I would like to start reviewing PB 6.0. Will there be problems if I load on the machine I used for PB 5.0 development? Any tricks or warnings I should know about? >I would like to start reviewing PB 6.0. Will there be problems if I load >on the machine I used for PB 5.0 development? Any tricks or warnings I >should know about? > I haven't seen any problems. The files are all named differently, so there should be no problem. Larry Cermak [Team Powersoft] | Moderator forums.powersoft.com.database Branick Consulting,Inc. | Moderator forums.powersoft.com.pow...

Web resources about - PB 6.0, VB 5.0 and COM Interface Question - sybase.ole-ocx-activex

Interface - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

iOS 9 How-To: Use the updated multitasking interface on iPhone and iPad
Ever since Apple made the move to a more ‘flat’ design with iOS 7 , the multitasking interface has changed in either a minor or major way with ...

Google streamlining Hangouts on the web with interface tweaks, higher quality video
Google has announced some updates coming to Hangouts video calls on the web, including a tweaked interface, along with faster, crisper full-screen ...

Dictionary.com Dictionary & Thesaurus goes 7.0 with interface improvements
... especially for longtime users of the app like me. Fortunately, here comes version 7.0 of the app to the rescue with a handful of welcome interface ...

Disney CEO & Apple board member Bob Iger calls Apple TV best television interface ever
... Executive Bob Iger said in an interview on Monday, praising Apple for creating what he believes is the most intuitive television user interface ...

Firefox 43 adds new block list, updates Android user interface
Mozilla has rolled out Firefox 43 FINAL for Windows, Mac and Linux, with Firefox 43 for Android due to follow imminently. The desktop build ...

Google Updates Search Interface For Tablets
It looks like Google updated the search interface for tablets and switched to the mobile UI. The previous tablet interface was an interesting ...

Day of the Tentacle Remastered's slick interface works flawlessly
When we learned at the PlayStation Experience keynote that Day of the Tentacle Remastered was releasing March 2016, I wrote that it had been ...

Google Camera Receiving Update for Android 6.0+ Devices, Includes New Interface
Google Camera , Mountain View’s in-house shooter software for Android devices, is receiving an update to build 3.1. Inside, the new UI that is ...

Collaborative User Interface From 'Minority Report' Is Here Today
NEWS ANALYSIS: The computer user interface as seen in the movie "Minority Report"—the ultimate in collaborative environments—is available now, ...

Resources last updated: 12/26/2015 5:16:15 AM