PDA

Click to See Complete Forum and Search --> : Difficult question - Experts Help Required


But_Why
Jun 29th, 2000, 06:46 AM
I have a structure being passed to by a callback.
One of the parts in the structure is a long called lpData, which is the address to the data in memory (i assume).
Now in the C equivalent code (which i'm trying to imitate), there is a loop in which loops though the data and gets various bits of info out of it.
Can anyone tell me, knowing (assuming) that the lpData is the pointer to the data in memory, how do i get the info out of memory using that pointer.
Confused? I am and i'm the one trying to do it. I have nearly finished a personal goal and this is what is blocking me at the moment.
Cheers in advance
But_Why

Jun 29th, 2000, 08:54 AM
Ok directly accessing memory is a time honoured technique in C and assembly


But


This isn't really a technique in VB as such

Hmmm....having said that try something like
Add a textbox to the form and set

textbox1 = lpData

Ok at this stage just want a report back on what shows up in the textbox. Is this memory allocation or what?????

Probably doesn't help you at the moment, but will maybe indicate to you, me, or some one else how to proceed.

But_Why
Jun 29th, 2000, 09:14 AM
I was thinking noone would be able to help.
I will try that tonight and let you know. If it helps then GREAT.

BTW i have seen an API around, i think it was
CopyStructFromMemory, or something to that effect.
Anyone know of it, or something that works similarly.

I'm pretty sure i have seen it before (of course only when i wasn't looking for it), but can't for the life of me find it again.

Cheers
BW

But_Why
Jun 29th, 2000, 11:49 AM
Anyone know about GlobalAlloc and GlobalLock
Also CopyStructFromPtr is what i was trying to get at before.
Cheers

KWell
Jun 29th, 2000, 01:01 PM
I think you can use the CopyMemory API
Take a look at the address for how to use ithttp://www.vbapi.com/ref/c/copymemory.html

Kersey
Jun 30th, 2000, 10:29 AM
what structure is being returned by the callback ?

But_Why
Jul 1st, 2000, 02:00 AM
Kersey: The callback is returning a buffer from the wavein device. I'm trying to extract the data from the buffer.

Anyone else done this in VB? I have found very little on it on the web. Very little. In fact, pretty much nothing in VB. Not a lot in C either hehehehe.

KWell: I have seen a copymemory thing around, i just couldn't remember what it was called. Thanks for the link, i'll look into it, and see if thats what i'm after.

Cheers guys, look forward to any other replies, and will try Kwells idea.
BW