Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: DENNIS JONES
  Where is DENNIS JONES?
 salina
 Kansas - United States
 DENNIS JONES
 To: Andy Kramek
  Where is Andy Kramek?
 Hot Springs Village
 Arkansas - United States
 Andy Kramek
 Tags
Subject: RE: Call DLL IN VFP
Thread ID: 153655 Message ID: 154962 # Views: 5 # Ratings: 0
Version: Visual FoxPro 9 Category: Classes and Objects
Date: Thursday, December 20, 2007 8:04:41 PM         
   


An advantage of using the OLEPublic class method is it illiminates the need to understand C+ programming concepts like iDispatch. For the Foxpro programmer, it provides a clean way to instantiate an object witch exposes a public interface without the need to code difficult Declare statements. Nor is it required to use Createobjectex, since now that you have a visual foxpro class, simply invoking with Newobject is sufficient.

> > Can someone help me by tomorrow.
> >
> > I need to VFP code to declare and call the dll below.
> >
> > I need to access the function fntdes in tdes.dll which
> > is a dll i need to use to encryp a string.
> > I can send this to you if you need to look at it.
> >
> > the only help I have on this is that the dll is written in
> > c++ and the following readme file below.....
> >
> > *****************************************************************************************
> >
> > // The following ifdef block is the standard way of creating macros which make exporting
> > // from a DLL simpler. All files within this DLL are compiled with the TDES_EXPORTS
> > // symbol defined on the command line. this symbol should not be defined on any project
> > // that uses this DLL. This way any other project whose source files include this file see
> > // TDES_API functions as being imported from a DLL, wheras this DLL sees symbols
> > // defined with this macro as being exported.
> > #ifdef TDES_EXPORTS
> > #define TDES_API __declspec(dllexport)
> > #else
> > #define TDES_API __declspec(dllimport)
> > #endif
> >
> > // This class is exported from the TDES.dll
> > class TDES_API CTDES {
> > public:
> > CTDES(void);
> > // TODO: add your methods here.
> > };
> >
> > extern TDES_API int nTDES;
> >
> > TDES_API int fnTDES(unsigned char *Key, unsigned char* EncVal, unsigned char *Token);
> > ***************************************************************************************
>
> VFP can only access COM DLLs by instantiating them as objects.
>
> You can use CREATEOBJECT() to if the DLL exposes the iDispatch and iUnknown interfaces (i.e. is late bound) and you need to check, in the object browser, whether this DLL was created that way or not. If not, then you may still be able to use early binding to access it, see CREATEOBJECTEX() for how to do that.
>
> Alternatively if the DLL was created as a Windows Dynamically Linked Library you will have to use the DECLARE command to expose its methods individually (as for any other API call).
>
> In any case the first thing to do is try opening it up in the VFP Object Browser and get a look at its classes, properties and methods.
>
> Regards
> Andy Kramek
> Microsoft MVP (Visual FoxPro)
> Tightline Computers Inc, Akron Ohio, USA

ENTIRE THREAD

Call DLL IN VFP Posted by Paul Newman @ 12/6/2007 7:04:52 PM
RE: Call DLL IN VFP Posted by DENNIS JONES @ 12/20/2007 12:22:28 AM
RE: Call DLL IN VFP Posted by Andy Kramek @ 12/20/2007 12:06:21 PM
RE: Call DLL IN VFP Posted by DENNIS JONES @ 12/20/2007 8:04:41 PM
RE: Call DLL IN VFP Posted by Andy Kramek @ 12/20/2007 9:38:33 PM
RE: Call DLL IN VFP Posted by DENNIS JONES @ 12/21/2007 12:40:19 AM
RE: Call DLL IN VFP Posted by Andy Kramek @ 12/21/2007 12:48:10 PM
RE: Call DLL IN VFP Posted by DENNIS JONES @ 12/21/2007 11:53:54 PM
RE: Call DLL IN VFP Posted by Andy Kramek @ 12/22/2007 11:40:09 AM