Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can a Java app access VFP DLLs methods & properties
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00669595
Message ID:
00669621
Views:
12
This is from Calvin Hsia in DNA08:
Demo: Java

To use your myserver COM server in a java program Run the Java Type Library Wizard (from the Devstudio Tools menu), and choose to import the Myserver type library. Choose File>New>Project and use the Java Applet Wizard and call it Jmyserver. Choose all the defaults in the Java Applet Wizard.

In the file jmyserver.java, imports section near the beginning, put
	import myserver.*;

In the class definition just a few lines below, put
	private Imyclass m_pf;

Just before the while (true) for the animation, put in the following
		com.ms.com.Variant v1 = new com.ms.com.Variant();
		com.ms.com.Variant v2 = new com.ms.com.Variant();
		String mystr;
		v1.VariantClear();
		m_pf = (Imyclass) new myclass();
		v1.putString("version(1)");	// fox expression
		v2 =m_pf.myeval(v1);
		mystr = v2.getString();

Just after the line "displayImage(m_Graphics)" in the While (true) loop, add
		m_Graphics.drawString(mystr,10,10);

Run the applet. You'll see the fox version as a string show up. 
>I want a Java application to access the properties and methods inside a VFP DLL. Anyone has any sample code to point me in the right direction.
Previous
Reply
Map
View

Click here to load this message in the networking platform