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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DLL and .NET

Status
Not open for further replies.

baseballgem

Programmer
Oct 3, 2001
54
US
I wrote a DLL in VFP (as single thread DLL) VFP7.0

The DLL works always has. It's called from virtually anywhere and as long as the correct parameters are passed everything's ok.

Upon using .net framework it's a different story. All help I've seen on line advises many things to get it to work. First of all the DLL does get instantiated, I can tell because certain parameters get returned under certain conditions but when a parameter is passed which suppose to open a file...
the offending line is IF FILE(tFileName)
RETURN -2
ELSE
etc...
ENDIF
A -2 is always returned, other calls withing the class are executed even in .NET but it seems to fail in know a file exists.
The parameter passed was "\\AN000603\localdata\allcalls.dbf"
IF THE FILE IS LOADED LOCALLY on "C:\mytest\allcalls.dbf"
Then it's fine within the .NET.
Advise I've already got was to modify the web config to let it know there's an external Component and to download a .NET patch.
A "FILE EXISTS()" function called from within the .NET does seem to recognize the files existence. Internal security was obviously acceptable. But when the same command is executed down in the DLL call, it's rebuffed. THE DLL is both referenced and registered.

I need to know how to get it to know a file exists and of course the biggie, use/open it, (By the way the file is a free table not in a DBC). This must trigger all from within the ASPM context. It's not a visual aspx page it's a non-visual kind of page that contains the dll which has to send a "Y" or "N" back to the aspx page.
 
FILE() has always been a tricky function. Even if you give it an explicit path to check for, it will return .T. if it finds a file with that name in the FoxPro .EXE (and I believe it applies to .APP or .DLL too), or if it finds one in the current FP PATH!

I've always used this function (or a variant of it) instead:
Code:
*FUNCTION gotfile
PARAMETERS zcfilename
PRIVATE zcfilename
IF TYPE(&quot;zcfilename&quot;) <> &quot;C&quot;
	RETURN .F.
ENDIF
DIMENSION laJunk[1] && so it's local 
RETURN (ADIR(laJunk, zcfilename, &quot;ARS&quot;) > 0)

* Note: Conscious decision to not include Hidden files made, so it matched results
*       of previous GOTFILE() AND FILE().
Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top