ASP.NET
Visual FoxPro 6 dll issue
Gravatar is a globally recognized avatar based on your email address. Visual FoxPro 6 dll issue
  Ramesh K
  All
  Jan 6, 2017 @ 12:45am

Hi

I created a Sample DLL using visual foxpro 6. The following steps done for making interface with Visual stuido 2015.

  1. Registerd the DLL using Regsvr32.

  2. Opened new solution under VIsual Studio 2015.

  3. Selected Reference and added the DLL reference.

  4. Worte one small class file and in that header section i added the statement using samproj

  5. The following statement written in one method. objWarp = createobject("samproj.warp") and it creates instance successfully.

  6. 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

Gravatar is a globally recognized avatar based on your email address. re: Visual FoxPro 6 dll issue
  Rick Strahl
  Ramesh K
  Jan 6, 2017 @ 01:24am

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 ---

Gravatar is a globally recognized avatar based on your email address. re: Visual FoxPro 6 dll issue
  Ramesh K
  Rick Strahl
  Jan 6, 2017 @ 06:43am

Hi

I am not clear. The sample code what i done for making vf6 dll to .net is as follows

  1. Registered the SamProj.dll using regsvr32.exe

  2. DLL added as a reference [DLL Name: SamProj.dll]

  3. In my VB class file, Header portion i added the following code. Imports SamProj

  4. 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
    
  5. 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

Gravatar is a globally recognized avatar based on your email address. re: Visual FoxPro 6 dll issue
  Rick Strahl
  Ramesh K
  Jan 6, 2017 @ 07:47pm

For one think you won't have rights to access a table in c:\data. Create a simple method that returns a string or something other that doesn't have dependencies and see if that works first.

+++ Rick ---

© 1996-2024