473,322 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

VB.net Access Violation Exception Error

I am using a DLL developed using Delphi. I tried calling the function in VB and encounter "AccessViolationException, Attempted to read or write protected memory"
In the main declaration:

Public PortNo As Integer
Public Res, Fun, Use As Integer
Public AreaID As Integer
Public PersonID, BuyCount, Fmt, Alarm, Shut, Tick, Comer As Integer
Public MaxRe As Integer
Public Buy, Power As Double
Public _Buy, nRe As Integer

'*** Declaration of the Function
Declare Auto Function _ReadBuyCard Lib "Sowin.dll" (ByVal _nPortNo As Integer, ByRef AreaID As Integer, ByRef PersonID As Integer, ByRef BuyCount As integer, ByRef Buy As Double, ByRef Format As integer, ByRef Power As Double, ByRef Alarm As integer, ByRef Shut As integer, ByRef MaxTick As integer, ByRef MaxRegrate As integer) As Integer


'*** Calling the function
Res = _ReadBuyCard(PortNo, AreaID, PersonID, BuyCount, Buy, Fmt, Power, Alarm, Shut, Tick, Comer) '*** This is where the error accurs

I have looked up some of suggestions in the internet such as using Byref and playing around with the data types such as int64 etc, but I still have not able to solve the problem.

I appreciate any suggestion.
Thanks
Jan 12 '12 #1
0 1269

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: William Brogden | last post by:
I am trying to use the php_java.dll and php5servlet.dll - from pecl-5.1.4-win32.zip - dated 5/04/2006 to execute php in a Tomcat5.5.9 servlet environment. Java 1.5.0 I finally got a configuration...
2
by: Curten | last post by:
Hi, I want to read data from a txt-file that looks like this: aaa 4 12.45 bbb 3 7.34 ccc 12 3.45 and store the data in an array of structures. The struct and array are defined...
1
by: Lee | last post by:
Hi all, been playing with some code overriding WndProc to get information about mouse events. So far I've tried to capture when the left mouse button is pressed using the code below. Sometimes...
23
by: pbaldridge | last post by:
I'm just starting my first C++ class and have a very basic question. We are to write a program that is going to be using the pow10(int m) function and we are not to use the pow10 function from the...
1
by: Kirzak pascuale | last post by:
ok I made this exercise, for a compiler design course. it is not urgent as the assignment was due 2 days ago. i got a 4 out of 10 for effort. mainly because i did not just rehash code examples from...
1
by: Johnex | last post by:
Hi! I am currently writing a tiny webserver that i can attach to all my applications to give them web functionality. I first started of making all the socket and helper classes to handle the...
3
by: =?Utf-8?B?eGJsZXNzaW5n?= | last post by:
Hello, I'm trying to communicate with a TEC Controller Newport 350B using their ..dll and VB.NET. I was able to use their example code with VB6. However, I've got following error when using...
5
by: zubair1 | last post by:
Hello, I have a program which deletes files from cache for exampe:- Temporary Internet Cache History Cache Cookie Cache and finally TEMP cache
3
by: amungen | last post by:
I am getting the following error from my code: Traceback (most recent call last): File "<pyshell#309>", line 1, in <module> get_handles('Python26') File "C:\Python26\e__handle.py", line...
2
by: dantz | last post by:
Hi Everyone, Currently I am having this exception: "Attempted to read or write protected memory. This is often an indication that other memory is corrupt." I am still debugging which part of...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.