Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Obtaining data value with memory address 1

Status
Not open for further replies.

RonF

MIS
Feb 17, 2001
3
US
I am working on a project to dynamically gather audio information from my sound card and process it real-time. I can successfully create and fill a buffer with audio information, but the API I am using only sends back a beginning address of my data buffer. This buffer contains data values I need to read individually as bytes (magnitude of volume). With only the beginning buffer address, how can I read the value of the first byte, the second byte, .... the last byte? I am using VB(5) and running under Win98.

Any help in cracking this question, along with example snipets of code, would be greatly appreciated.

 
Ron,

I'm not aware that what you need to do (get to data pointed to be a C pointer returned from an API) is directly supported by and version of VB (unless someone else knows different of course).

I do this kind of thing with the functions in the apigid32.dll supplied with "Visual Basic 5.0 Programmers Guide to the Win32 API" By Dan Appleman from ZD Press ISBN 1-56276-446-2; I recommend this book to you, it is invaluable.
Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
LOL Mike! The book is also out of print. My 16-bit version of Appleman's boot was a little out of date so I went shopping for the newer one. I must have been a day late and ended up buying Dan Appleman's Win32 API Puzzle Book and Tutorial for Visual Basic Programmers.

Not nearly as handy as his earlier references. Dan has changed his strategy. Instead of telling us how to do it he teases us with a puzzle. If we figure it out, fine, if we don't... start from the beginning and try again.

Actually, Mike, I believe you are right about the memory question. You might be able to do it with C++ but I would be a little suspicious of the results.

Anybody have a spare copy of the Programmer's Guide? Please fax it to me.
VCA.gif

Alt255@Vorpalcom.Intranets.com
 
The new edition is ISBN 0672315904, have it in stock --- so they say.

I didn't get the puzzle book, looked too much like hard work to me <smile>

Ron -- are you still having trouble with this?
Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
Mike,

Thanks for the recommendation. I haven't yet found a copy of the book.

You had mentioned that you do this kind of thing with the functions in the apigid32.dll. Where does one find information on available functions within DLL's in addition to their descriptions and associated examples? This would include things like kernel32.dll?

I'm not in too much of a hurry (ha, ha), but I have been banging my head on this address value issue for over 3 weeks to no avail. Is this really something that VB(5) is capable of doing or should I focus more on a Visual C++ implementation?

Thanks,

Ron Fonden
fondenr@seanet.com
 
Here we go:

VarPtr, VarPrtArray, VarPtrStringArray, ObjPtr and StrPtr:

undocumented functions used to get the underlying memory address of variables

Seem to work OK in VB 5 and 6, will not be available in Visual Basic.NET. Get's you around your current problem though Ron -- you don't need that DLL I mentioned earlier just to get the address of some variables. Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top