[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Directly read a byte of memory using an address

Posted on 1999-12-30
7
Medium Priority
?
243 Views
Last Modified: 2010-05-02
I have an instrument which uses a DLL to read some data.

The DLL gives me a pointer to the location in memory.

I want to read the bytes.

The instrument actually gives 32k bytes of Data.

How do I take the pointer given by the DLL code and read the 32k bytes of data.


0
Comment
Question by:skuhn
  • 4
  • 2
7 Comments
 
LVL 1

Expert Comment

by:cvidler
ID: 2316304
you won't do it with VB. Try with C/Pascal
0
 

Author Comment

by:skuhn
ID: 2317555
Adjusted points to 140
0
 

Author Comment

by:skuhn
ID: 2317556
Adjusted points to 150
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
LVL 2

Accepted Solution

by:
chris_a earned 450 total points
ID: 2319048
Allocate an array and use RTLMemMove to move the data into VB world

Use these with care:-

' caution if passing string as any you must add "byval"
Declare Sub MemCopy Lib "kernel32" Alias "RtlMoveMemory" (hpvDest As Any, hpvSource As Any, ByVal cbCopy As Long)
Declare Sub MemSet Lib "kernel32" Alias "RtlFillMemory" (hpvDest As Any, ByVal cbLength As Long, ByVal bFillWith As Byte)
0
 

Author Comment

by:skuhn
ID: 2321273
Thankyou very much for the answer.

I am new to visual basic and would appreciate a bit more detail.

I will try to test the answer, but a few lines of detail from you will probably save me hours.
0
 
LVL 2

Expert Comment

by:chris_a
ID: 2321397
Try something like:

####################################
Dim m_abDATA(0 to 255) as BYTE

MemCopy(m_abData, BufAddr, 256)
Debug.print m_abData(0) ' print 1st byte
####################################

I use these rotines to extract data from binary messages recieved over a serial/tcip link to VB structures, I haven't tried it with the shared memory data aquisition scheme you mention, there should be no problem except for synchronisation, do you have to obey/maintain a semaphore?

0
 

Author Comment

by:skuhn
ID: 2323724
Thankyou, I still have to sort out the details but I am now on track.

I searched  microsoft.com for

"RtlMoveMemory" and found more information

0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

591 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question