INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

COM and Automation

Creating Form as COM Server in VFP 7 to be used in VB by Walid
Posted: 19 Jun 02

After you design your form to be 100% self contained meaning it has to run correctly by it self in VFP as a stand alone form, modify your form and select Save As Class
Save your form as a class under the name myForm for example in a visual class file ActiveXFormClass.vcx.

Modify the class and from Class menu select Class Info and check OLE Public and save.

Now, Start a new project ActiveXFormTest for example and add your class to it.
Save the project and build as Exe COM Server (Not dll).

This will register your COM Server in your computer but donÆt forget to register it your self in any machine you will run your program on either manually
Activexformtest.exe /regserver or through the Setup program.


Test your COM Server from VFP first

o=CREATEOBJECT("Activexformtest.myform")
o.Visible=.T.
o=Null
RELEASE o


Start new EXE project from VB. From the Project menu select reference and check Activexformtest Type Library.

In the General declaration section (or wherever you see fit) add


Public loVFPForm As activexformtest.myform


It doesnÆt need to be public variable.

Now, add a command button and give it Caption Show VFP Form.
In the click event add

Set loVFPForm = CreateObject("activexformtest.myform")

loVFPForm.Show (1)

This is your VFP form as an ActiveX control or Out-of-Process COM Server or whatever name you like, it is just there.

Even though This will answer your question, I donÆt recommend this technique at all.
From a design point of view, you suppose to separate your GUI from the Biz logic, what will happen if you want to run the same functionality your form offer over the Web??
So, instead of doing that try to design a Biz object provide you all the functionality you need in VFP and call it from VB native GUI,I believe this is a better design.

Best of luck


Back to Microsoft: Visual FoxPro FAQ Index
Back to Microsoft: Visual FoxPro Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close