Wiki Home

Create Object Ex

Namespace: VB
The CREATEOBJECTEX() function is similar to CREATEOBJECT() function, only you can specify the UNC/DNS/IP address of the computer where this component will execute.

This is DCOM.
In order to instantiate an object with DCOM you need to do one of two things.

1. The com object must be registered on the local machine if you want to use the progid (name of the exe)


oX = createobjectex('FoxPro.Application','otherpc')

2. or, Use the clsid (UUID) if you don't register it on the local machine...


oX = createobjectex('{008B6010-1F3D-11D1-B0C8-00A0C9055D74}','MachineName')

You also of course need rights to launch and execute the com object on the remote machine.

It is simple to get the GUID of an automation server using the OLE viewer. Just open the OLE viewer and find the entry for your server on the list. Open the Application ID's tree and find your server. Right click on it and it allows you to send the GUID to the clip board. What is / Where is the OLE viewer? - ?wgcs

OLE View is a utility that installs as an option of Visual Studio. It displays all COM objects registerd on your system, all type libraries and interfaces. If installed, it should be under Microsoft Visual Studio 6.0 Tools. -- Larry Miller
I'd add that you should always try to run it from the machine it's installed on before you try to run it remotely. Setup issues are much easier to troubleshoot that way.
I'm having an issue using this involving network paths. I created a project (called DCOM), including only this class:
define class test as form olepublic
    procedure init()
        set exclusive off
    procedure evalu8()
        lparameters lcdo
        ON ERROR return "Error " + LTRIM(STR(ERROR())) + "|" +;
          "Message()  " + MESSAGE() + "|" + ;
          "Message(1) " + MESSAGE(1) + "|" + ;
          "SYS(2018) " + SYS(2018) + "|"
        return x

I compiled as DCOM.EXE, copied to the server box, and typed 'dcom /regserver'.
From the command window on my dev box:
returns .t.
returns .t.
returns .t.
returns .f.

Local works fine, any subdirectory of any network drive doesn't. I can't get it to recognize UNC at all.

-- ScottMinar
Category VFP Functions Category C _ O _ M
( Topic last updated: 2001.01.30 05:43:07 PM )