Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Removing a DLL from Memory
Message
 
 
To
07/04/2000 12:10:12
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00356822
Message ID:
00357234
Views:
13
Bill,

Check out the DeQuote example on my website it's VC6. The SpyIn sample has a VC5 style sample in it.

>>>>The one thing that either I missed or you didn't say was that, according to your later posts, this is an OLE Automation DLL and not a standard C DLL. Is this correct? I've never had a problem with VC++ (or other language for that matter) compiling unless some reference was being held to either a function or the object that's been created. Simply setting the reference to NULL or CLEAR DLLS usually clears things up. There is an exception, however, that applies to automation servers. Habitually, I call the DllRegisterServer() function from VFP. If I need to re-compile during a session where I've called it, I need to CLEAR DLLS prior to the recompile.
>>>>
>>>I am following Ivor Horton's example in his book Beginning VC++6 in the "Using the Active Template Library" chapter for building COM DLLs. I basically just used his example replacing his declared parameters with what I "think" mine ought to be in the function. Function prototypes are:
>>>
>>>In the C++ file header:
>>>HRESULT __stdcall CIssSysData::IssUserName( LPSTR cBuffer, LPDWORD nSize, long* retval )
>>>
>>>In the IDL file:
>>>HRESULT IssUserName( [in] LPSTR cBuffer, [in] LPDWORD nSize, [out, retval] long* retval );
>>>
>>>Function declaration in the C++ CPP file:
>>>HRESULT __stdcall CIssSysData::IssUserName( LPSTR cBuffer, LPDWORD nSize, long* retval )
>>>
>>>I've tried different variable type declarations experimenting, but I continue to get errors.
>>>
>>>In VFP CREATEOBJECT() will instantiate the obect, but when the call is made to the DLL function I get "OLE error code ... Bad variable type". Code is:
>>>
>>>ox = createobject( "SysData.IssSysData" )
>>>cSize = 256
>>>cUser = SPACE( cSize )
>>>nResult=ox.IssUserName(@cUser,@cSize)
>>>
>>>In VB when trying to make the EXE I get the error:
>>>"Function interface marked as restricted, or the function uses an Automation type not supported in Visual Basic"
>>>Code is:
>>>
>>>Dim retval&
>>>Dim size&
>>>Dim MyUserId
>>>MyUserId = Space(257)
>>>Dim objSysData As New IssSysData
>>>retval = objSysData.IssUserName(cBuffer:=MyUserId, nSize:=size)
>>
>>>This is all pretty much the way Horton does it in his example ( which I built and got to run ) except the function parameters are different and of different types.
>>
>>Sorry, Bill, this is beyond me. I'm still working on his Beginning C++ 4 book, which does touch on this. See, told ya I'm behind the curve.:-)
>
>Lots of curves out there George. can't be in front of all of 'em. :-) I doubt if you're behind any that matter. :-)
>
>Well, maybe one of the C++ gurus will chime in and straighten me out.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform