1. amit kurhe
  2. PowerBuilder
  3. Thursday, 26 September 2019 19:07 PM UTC

I am new to powerbuilder supporting an old app getting some migration issues, one of code line extracted below giving the error accessing external object. what are the parameters i have to check to run this program or the code missing something. do i have to run any supporting software or active x control.  thanks 

OLEObject o1
string s1
o1 = CREATE OLEObject
s1="C:\TEST\testfile.avi"
o1.Object.Open(s1);  -- this line throwing error accessing object. 

amit kurhe Accepted Answer Pending Moderation
  1. Monday, 30 March 2020 16:14 PM UTC
  2. PowerBuilder
  3. # 1

thanks all, issue resolved after registering the MSCOMCT2.ocx which was missing the latest windows version & prerequiste for the animation control.

Comment
There are no comments made yet.
Michael Kramer Accepted Answer Pending Moderation
  1. Wednesday, 2 October 2019 23:55 PM UTC
  2. PowerBuilder
  3. # 2

Hi Amit,

OLEObject itself is just a proxy for talking to a COM object. Once created, you only have an empty proxy without content.

The proxy needs to connect to a COM object. That's where ConnectToNewObject comes into play. When that succeeds your proxy has access to that specific COM object.

You can access the COM object via the proxy using o1.object.XXX notation. Calling Open(string) requires your COM object has such a function. There are no compiler checks since COM calls are dynamic.

COM object's documentation should describe its API. Calling non-defined functions *WILL* throw exceptions.

AVI files are video files. So you need to make sure that your COM object knows how to handle AVI files. Like telling your XML parser to open a video: That action is probably undefined or leads to app crash.

NOTE

IF identical code runs on some machines but not on other machines - AND - the failing code involves OLEObject to access a COM object - THEN - My first attempt at solving the issue would be:

ACTION: Check whether the COM object class that your app tries to access actually exists on the failing machines.
STEPS:

#1: First find the COM object in Windows Registry on a working machine - so you know what to look for.

#2: Then look for same definition on failing machine. If it is missing: Bingo! You found reason for failure.

HTH /Michael

Comment
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Wednesday, 2 October 2019 21:00 PM UTC
  2. PowerBuilder
  3. # 3

It would be a big help if you told us what exactly you need to do with the file.

As Chris added, AVI is a video format. If you want to view the video, I would suggest using a IE WebBrowser control and passing the file name to the Navigate function. I'm not 100% sure it will work but it is worth a try. I have an example app here:

http://www.topwizprogramming.com/freecode_webbrowser.html

 

Comment
There are no comments made yet.
amit kurhe Accepted Answer Pending Moderation
  1. Wednesday, 2 October 2019 20:24 PM UTC
  2. PowerBuilder
  3. # 4

I tried with connectTonewobject passing different type still no luck it gives error on the open method. 

Not sure if this is related to any ocx registry or code issue. Need help on that. 

 

OLEObject o1
integer res1
o1 = CREATE oleobject
res1=o1.ConnectToNewObject("microsoft.XMLDOM") // Msxml2.XMLHTTP /excel.application
If res1 = 0 Then
o1.Object.Open("C:\testfile\test.avi") // this line gives error
MessageBox ("test1","Success");
Else
MessageBox ("test","Failure");
End If

 

thanks. 

Comment
  1. Chris Pollach @Appeon
  2. Wednesday, 2 October 2019 20:45 PM UTC
Hi Amit;

FWIW: I am pretty sure that the XML processor is not going to handle a video (AVI) file.

Regards ... Chris
  1. Helpful
  1. amit kurhe
  2. Wednesday, 2 October 2019 21:06 PM UTC
Hi Chris, thanks for replying. i tried to give a code from existing application where its throwing a error. the same application exe works on some machines & for some machines it does not work. So want to know what are the component i have to check on the PC to get the Open method get working . i tried microsoft.XMLDOM/ Msxml2.XMLHTTP /excel.application/outlook to call the avi file but its not working. hope you understand the problem.

thanks
  1. Helpful
  1. Roland Smith
  2. Thursday, 3 October 2019 19:27 PM UTC
AVI files are videos so you must have video playback software installed and connect to that. Outlook or Excel are not going to play a video no matter how hard you try.
  1. Helpful
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Thursday, 26 September 2019 19:29 PM UTC
  2. PowerBuilder
  3. # 5

Usually there is a call to ConnectToNewObject. This example connects to Outlook. You need to find out the OLE object name that it needs to connect to.

OLEObject o1

Integer li_rc

o1= CREATE OLEObject

li_rc = o1.ConnectToNewObject("Outlook.Application")
If li_rc = 0 Then

... success ...

Else

... failure ...

End If

 

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.