Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CreateObjectEX not
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00559579
Message ID:
00559796
Views:
22
Hi John,

Here's a small step by step example. I did this using VFP7 and Win2K Pro.

1. Create a multi-threaded dll in vfp. I created a project called "testvfpcom" and added a PRG named "testvfpcom". The PRG contained this code:
define class testvfpcom as session olepublic
    procedure SayHello
        return("Hi There!")
    endproc
enddefine
Build the project as a multi-threaded dll.

2. Click Start->Settings->Control Panel->Administrative Tools->Component Services.

3. Expand the Component Services node, then Computers, then My Computer, then COM+ Applications. Right click on COM+ Applications and select New->Application. The COM Application Install Wizard appears. Click Next.

4. Click "Create an empty application". Enter a name and select "Server Application". Click Next.

5. Select "This User" and enter Administrator for the user and the administrator's password (this is OK for testing but in a production app you would want to create a user specifically for the application.) Click Next, then Finish.

6. Expand the new application's node. Right click Components, select New->Component. The COM Component Install Wizard appears. Click Next.

7. Click "Import component(s) that are already registered." The component list will appear. Scroll down and hilight "testvfpcom.testvfpcom". Click Next, then Finish. If you hilight the "Components" node you will see your component represented by a ball with a plus sign in it.

8. Switch back to VFP and type this:
oo = createobject("testvfpcom.testvfpcom")
If you did it right after a moment the cursor will just drop down. If you switch back to Component Services the ball should now be rotating. That means it's running.

9. In VFP type
? oo.SayHello
It should respond by printing "Hi There".


If you want to try this on a different computer across a network, right click on the component and select Properties. Make a note of the CLSID. On another computer that has permission to access the server start VFP (I used 7 but I believe it works in 6 also.) In the command window type:
oo = createobjectex("{your_clsid_here}", "your_server_name_here")
Replace {your_clsid_here} with the class id you made note of and replace "your_server_name_here" with the name of the server. If everything is setup correctly you should have the same result you did above.

This is a real simple example and just scratches the surface but hopefully should get you started.

>Hi,
> How to register under COM+? Does it require IIS or any other tool to support?
>
>Thank you
Previous
Reply
Map
View

Click here to load this message in the networking platform