Question Attempted to read or write protected memory

butzjr

New member
Joined
Apr 26, 2010
Messages
1
Programming Experience
3-5
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
 
Back
Top