Hi
I created a Sample DLL using visual foxpro 6. The following steps done for making interface with Visual stuido 2015.
Registerd the DLL using Regsvr32.
Opened new solution under VIsual Studio 2015.
Selected Reference and added the DLL reference.
Worte one small class file and in that header section i added the statement using samproj
The following statement written in one method. objWarp = createobject("samproj.warp") and it creates instance successfully.
When i tried to access the property or method from the object, system showing the following error. [objWarp.Datapath ="c:\data"] - While executing this statement the following error raise.
Exception thrown at 0x0582039C in VBWrapperTestApp.exe: 0xC0000005: Access violation executing location 0x0582039C.
I tried all the possibilities. but still i am getting this error. Can you help me how to sort out this problem
Regards Ramesh K iyer act_ramesh@hotmail.com
You should use the dynamic
keyword, rather than importing a reference. You won't get strong typing but you get access to the full COM interface instead of just the top level object.
If you do use the COM wrapper, you don't use CreateObject()
but new importedTypeName()
(in c# - vb syntax will be slightly different).
+++ Rick ---
Hi
I am not clear. The sample code what i done for making vf6 dll to .net is as follows
Registered the SamProj.dll using regsvr32.exe
DLL added as a reference [DLL Name: SamProj.dll]
In my VB class file, Header portion i added the following code. Imports SamProj
In my method the following code i written.
Public Sub New()
Try objWrite = createObject ("SamProj.Proj") objWrite.DATAPATH = "C:\Datal\" objWrite.Tablename = "emp.dbf" xobj = objWrite.ExecuteQuery("Select * from emp") catch ex as Exception End Try
While executing the above code, the property assign place i am getting that error.
Can you help me sort out this issue
Regards Ramesh K Iyer Write to : act_ramesh@hotmail.com