Attempted to read or write protected memory

Announcements and discussion for PInvoke

Moderators: Luke Jefferson, Robert

Attempted to read or write protected memory

Postby butzjr » Mon Apr 26, 2010 11:04 pm

I am trying to use a .dll in .Net that was written in C++ and was previously used in a VB6 application. I get the error mentioned above. I see lots of posts referring to how VB6's long data type is different in .Net but these functions use only integers and strings. Can anyone tell me what is wrong with this?

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Module1.lp_checkout("Redistricting", "9.0", 1)
End Sub


Module Module1

Public Declare Function lp_setup Lib "C:\\Documents and Settings\\dbutz\\My Documents\\Visual Studio 2008\\Projects\\flexNetSample\\flexNetSample\\bin\\ddp_ lm.dll" (ByVal LicDefault As String) As Integer
Public Declare Function lp_checkout Lib "C:\\Documents and Settings\\dbutz\\My Documents\\Visual Studio 2008\\Projects\\flexNetSample\\flexNetSample\\bin\\ddp_ lm.dll" (ByVal FeatureName As String, ByVal featurever As String, ByVal liccount As Integer) As Integer
Public Declare Function lp_checkin Lib "C:\\Documents and Settings\\dbutz\\My Documents\\Visual Studio 2008\\Projects\\flexNetSample\\flexNetSample\\bin\\ddp_ lm.dll" (ByVal FeatureName As String) As Integer
Public Declare Function lp_shutdown Lib "C:\\Documents and Settings\\dbutz\\My Documents\\Visual Studio 2008\\Projects\\flexNetSample\\flexNetSample\\bin\\ddp_ lm.dll" () As Integer
Public Declare Function lp_cryptstr Lib "C:\\Documents and Settings\\dbutz\\My Documents\\Visual Studio 2008\\Projects\\flexNetSample\\flexNetSample\\bin\\ddp_ lm.dll" (ByVal InLic As String, ByVal OutLic As String, ByVal BufLen As Integer, ByVal Flag As Integer) As Integer
Public Declare Function lp_errstring Lib "C:\\Documents and Settings\\dbutz\\My Documents\\Visual Studio 2008\\Projects\\flexNetSample\\flexNetSample\\bin\\ddp_ lm.dll" (ByVal ErrorStr As String, ByVal BufLen As Integer) As Integer
Public Declare Function lp_heartbeat Lib "C:\\Documents and Settings\\dbutz\\My Documents\\Visual Studio 2008\\Projects\\flexNetSample\\flexNetSample\\bin\\ddp_ lm.dll" (ByVal NumReconnect As Integer, ByVal NumMinute As Integer) As Integer
Public Declare Function lp_hostid Lib "C:\\Documents and Settings\\dbutz\\My Documents\\Visual Studio 2008\\Projects\\flexNetSample\\flexNetSample\\bin\\ddp_ lm.dll" (ByVal HostType As Integer, ByVal hostidstr As String, ByVal BufLen As Integer) As Integer



End Module

Thanks,
David
butzjr
 
Posts: 1
Joined: Mon Apr 26, 2010 11:01 pm

Return to PInvoke.Net

Who is online

Users browsing this forum: No registered users and 0 guests

cron