Red Gate forums :: View topic - Attempted to read or write protected memory
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
PInvoke.Net
PInvoke.Net forum

Attempted to read or write protected memory

Search in PInvoke.Net forum
Post new topic   Reply to topic
Jump to:  
Author Message
butzjr



Joined: 26 Apr 2010
Posts: 1

PostPosted: Mon Apr 26, 2010 11:04 pm    Post subject: Attempted to read or write protected memory Reply with quote

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 to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group