Attempted to read or write protected memory. C++ dll vs vb 2005

I

ianyian

Hi experts,
i try to use vb.net 2005 call C++ 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top