|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Attempted to read or write protected memory. dll vs vb 2005i try to use vb.net 2005 call dll, then give me "Attempted to read or write protected memory.This is often an indication that other memory is corrupt". i have chk some message others people posted, but since still cannot, pls give me some commnet.(this dll run smoothly at vb 6 ) module: ' example Declare Function TwTsxInitPar Lib "TSDKVC.DLL" _ (ByRef tsxparptr As Byte, ByVal asize As Long) As Long Declare Function TwTsxParSetMaxTermLid Lib "TSDKVC.DLL" _ (ByRef tsxparptr As Byte, ByVal maxtermlid As Long) As Long public sub run() dim btsxpar(1024) As Byte dim lnTerm as long vtek.lRv = TwTsxInitPar(btsxpar(0), UBound(btsxpar) + 1) <== msg popup PIvokeStackbalance was detected vtek.lRv = TwTsxParSetMaxTermLid(btsxpar(0), lnTerm) <== give same msg ............ end sub after run the program ( console ) give "Attempted to read or write protected memory.This is often an indication that other memory is corrupt" pls give advise, bcos i really have no any idea( vb6 can work ) many thanks XJ,
Are you sure it should be Long. A VB6 Long is a VBNet Int32. To be real, I think that it is your problem. I hope this helps, Cor Show quoteHide quote "XJ" <iany***@gmail.com> schreef in bericht news:1149338525.692617.114260@h76g2000cwa.googlegroups.com... > Hi experts, > i try to use vb.net 2005 call dll, then give me "Attempted to > read or write protected memory.This is often an indication that other > memory is corrupt". i have chk some message others people posted, but > since still cannot, pls give me some commnet.(this dll run smoothly at > vb 6 ) > > module: > ' example > Declare Function TwTsxInitPar Lib "TSDKVC.DLL" _ > (ByRef tsxparptr As Byte, ByVal asize As Long) As Long > Declare Function TwTsxParSetMaxTermLid Lib "TSDKVC.DLL" _ > (ByRef tsxparptr As Byte, ByVal maxtermlid As Long) As Long > > public sub run() > dim btsxpar(1024) As Byte > dim lnTerm as long > > vtek.lRv = TwTsxInitPar(btsxpar(0), UBound(btsxpar) + 1) > <== msg popup PIvokeStackbalance was detected > vtek.lRv = TwTsxParSetMaxTermLid(btsxpar(0), lnTerm) <== > give same msg > ............ > end sub > > after run the program ( console ) give > "Attempted to read or write protected memory.This is often an > indication that other memory is corrupt" > > pls give advise, bcos i really have no any idea( vb6 can work ) > many thanks > "XJ" <iany***@gmail.com> schrieb: Try these declarations:> i try to use vb.net 2005 call dll, then give me "Attempted to > read or write protected memory.This is often an indication that other > memory is corrupt". i have chk some message others people posted, but > since still cannot, pls give me some commnet.(this dll run smoothly at > vb 6 ) > > module: > ' example > Declare Function TwTsxInitPar Lib "TSDKVC.DLL" _ > (ByRef tsxparptr As Byte, ByVal asize As Long) As Long > Declare Function TwTsxParSetMaxTermLid Lib "TSDKVC.DLL" _ > (ByRef tsxparptr As Byte, ByVal maxtermlid As Long) As Long \\\ Private Declare Function TwTsxInitPar Lib "TSDKVC.DLL" ( _ ByRef tsxparptr As Byte, _ ByVal asize As Int32 _ ) As Int32 Private Declare Function TwTsxParSetMaxTermLid Lib "TSDKVC.DLL" ( _ ByRef tsxparptr As Byte, _ ByVal maxtermlid As Int32 _ ) As Int32 /// > dim btsxpar(1024) As Byte Note that this will create an array with 1025 elements with indices 0 through 1024. > dim lnTerm as long => 'As Int32' or 'As Integer'.If this doesn't solve the problem, I suggest to post the C/C++ function prototypes. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> thanks advise ! appreciate
Herfried K. Wagner [MVP] wrote: Show quoteHide quote > "XJ" <iany***@gmail.com> schrieb: > > i try to use vb.net 2005 call dll, then give me "Attempted to > > read or write protected memory.This is often an indication that other > > memory is corrupt". i have chk some message others people posted, but > > since still cannot, pls give me some commnet.(this dll run smoothly at > > vb 6 ) > > > > module: > > ' example > > Declare Function TwTsxInitPar Lib "TSDKVC.DLL" _ > > (ByRef tsxparptr As Byte, ByVal asize As Long) As Long > > Declare Function TwTsxParSetMaxTermLid Lib "TSDKVC.DLL" _ > > (ByRef tsxparptr As Byte, ByVal maxtermlid As Long) As Long > > Try these declarations: > > \\\ > Private Declare Function TwTsxInitPar Lib "TSDKVC.DLL" ( _ > ByRef tsxparptr As Byte, _ > ByVal asize As Int32 _ > ) As Int32 > > Private Declare Function TwTsxParSetMaxTermLid Lib "TSDKVC.DLL" ( _ > ByRef tsxparptr As Byte, _ > ByVal maxtermlid As Int32 _ > ) As Int32 > /// > > > dim btsxpar(1024) As Byte > > Note that this will create an array with 1025 elements with indices 0 > through 1024. > > > dim lnTerm as long > > => 'As Int32' or 'As Integer'. > > If this doesn't solve the problem, I suggest to post the C/C++ function > prototypes. > > -- > M S Herfried K. Wagner > M V P <URL:http://dotnet.mvps.org/> > V B <URL:http://classicvb.org/petition/>
Adding row to table
Timer Component for VB 2005 .aspx page? Access database insert statement with an autonumber (identity) in vb.net Datagrid current row edits Exposing a .Net assembly to both VB6 and .Net (1 more time) Does file exist Numeric / Currency control InvalidCastException in DataRow webbrowser control to submit form Read data directly from a textbox and insert into a table |
|||||||||||||||||||||||