Solved

Visual Studio 2005 (VB) - Calling FoxPro Program

Posted on 2014-12-12
3
323 Views
Last Modified: 2014-12-15
Hello Experts!
OK so this works fin on my laptop because I have FoxPro installed...but does NOT work on a PC that doesn't have FoxPro installed.

I thought that when I added the reference to FoxPro and it loaded this file (Interop.VisualFoxpro.dll) to my Debug Director as long as that file was present in the application directory on the PC without FoxPro it would use this dll for any and all FoxPro commands.

I'm trying to execute a report from my Visual Basic program and as I mentioned it works fine on my laptop it is when I load (copy) everything down to the PC without FoxPro install it doesn't work...I get Retrieving the COM Class factory for component...etc.

Here is my code:
                Dim FoxPro As New VisualFoxpro.FoxApplication

                FoxPro.DefaultFilePath = sSitePath & "Programs\"
                FoxPro.DoCmd("DO " & sSitePath & "Programs\r_ach_items.prg WITH 'sOutFile & "'

Thanks,
Mark
0
Comment
Question by:smithmrk
3 Comments
 
LVL 79

Assisted Solution

by:David Johnson, CD, MVP
David Johnson, CD, MVP earned 100 total points
ID: 40497589
Did you add the runtime libraries to the client machine that doesn't have vfp installed?
http://msdn.microsoft.com/en-US/library/tz3tcs63(v=vs.80).aspx
0
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 400 total points
ID: 40498293
The interop is simply a bridge between your application (.NET) and the FoxPro library (COM). It makes the changes and type translations needed for the 2 worlds (.NET and COM) to communicate.

When you reference something that comes from the COM tab, the interop is generated, but the dll that you referenced is not really referenced. And the tools that generate setup programs won't include them in the distribution, to prevent the distribution of files that might be copyrighted. Otherwise, you would simply have to reference Microsoft Excel in one of your application and Word would be automatically installed for any user that uses your application.

You thus have to make sure you have the right to do so, and if so, install these dlls manually, through a script, or add them to whatever you use to distribute your application to your users.

As for the 2 files that are required for FoxPro and listed in the David's link, legally you have the right to redistribute them with your application if you have a valid license for FoxPro.
0
 

Author Closing Comment

by:smithmrk
ID: 40500520
Thanks for the explanation!

I thought that the Interop was a conversion from the COM DLL to the .Net version...didn't realize it was just a way to communicate to the COM DLL.
That just goes to show you how much I know about the COM DLL's in .Net!  I appreciate you taking the time to explain it to me, and I will be registering the FoxPro COM DLL now as we do have a valid license.

Thanks to both of you for helping me through my issue.

Mark
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now