Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Created .dlls from VFP7 Project

Status
Not open for further replies.

castor2003

Programmer
Jul 5, 2003
115
LC
I have this project with a .prg which defines an OLEPUBLIC class that I want to send to someone as a .dll from which the functions can be run. This is what a what I did.

In the project's TESTDLL.PRG. Only item in the project.


Code:
DEFINE CLASS holy AS CUSTOM OLEPUBLIC

  PROCEDURE trnsform
  LPARAMETERS nLen,cText,cRetvalue

   ****
   *OTHER CODE HERE
   *****

  RETURN cReply

ENDDEFINE



After BUILDing this project, I wrote the following PRG to call it as an API

Code:
DECLARE INTEGER ShellExecute IN shell32.dll ; 
  INTEGER hndWin, ; 
  STRING cAction, ; 
  STRING cFileName, ; 
  STRING cParams, ;  
  STRING cDir, ; 
  INTEGER nShowWin


cFileName = [regsvr32.exe]
cParams	=[/s mybuilt.dll]

cDir	= []
cAction = [OPEN]
=ShellExecute(0,cAction,cFileName,cParams,cDir,0)



DECLARE STRING trnsform IN "mybuilt.dll" ;
	LONG nLen, STRING cText, STRING cRetvalue
	
nLen  = 3
cText = [Hello World]
cRetvalue = [SIZE]

	
? trnsform(nLen,cText,cRetValue


When I run that PRG I get the message "Cannot find entry point trnsform in the DLL"

What could I be doing wrong?







 
CASTOR2003

faq184-3381


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Castor,
To emphasize Mike's FAQ info: VFP can only create COM server .DLLs - you can't call these with a DECLARE statement - just CREATEOBJECT().

Rick
 
I tried Mike's stuff which works. But it does restrict you in terms of simple interfaces such as MESSAGEBOX(). Does it have any real use?
 
I am finding value for it to keep my Application Exe thin by doling out as much functions as possible to dlls. So at the start of my application I WILL DO THE FOLLOWING FOR EACH dll

PUBLIC oData as Custom
oData = CREATEOBJECT('data.UDFS')

PUBLIC oDisplay as Custom
oDisplay = CREATEOBJECT('display.UDFS')

and so on. Then I will have the ardous task of keeping interfaces out of the picture.. Hmmm that must be hard work.
 
Castor2003

I'm currently using one to generate an XML file for 11,000 invoices, no interface required. Yes I can think of many uses.


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top