Directly read a byte of memory using an address

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.


skuhnAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

cvidlerCommented:
you won't do it with VB. Try with C/Pascal
0
skuhnAuthor Commented:
Adjusted points to 140
0
skuhnAuthor Commented:
Adjusted points to 150
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

chris_aCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
skuhnAuthor Commented:
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
chris_aCommented:
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
skuhnAuthor Commented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.