forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


API returning a pointer

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
dmonckton
Contributor
Contributor


Joined: 09 Aug 2002
Posts: 117
Location: Lewes, U.K.

PostPosted: Thu Aug 13, 2009 3:25 pm    Post subject: API returning a pointer Reply with quote

Hi

I've found a 3rd party MIDI API which might do everything I need? The only trouble is some of the functions return pointers to strings of info I need. I've got the function to work but how do I dereference the pointer in VDS?

Here's an example of one of the function I've got working...
Code:

LPCSTR MidiGetDeviceName(bool b_midiIn, DWORD dw_deviceNum);

I get an integer which must point to the string containing the device name, how do I get to the string?

Thanks

David...
Back to top
View user's profile Send private message
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Thu Aug 13, 2009 3:32 pm    Post subject: Reply with quote

David,
Have you tried this.

Code:

%A = @lib(mididllname,MidiGetDeviceName,STR:,BOOL:%%b_midiIn,INT:%%dw_deviceNum)


In the future if you could send a VDS example/attempt it would help. At the very least the name of the DLL your using.

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
dmonckton
Contributor
Contributor


Joined: 09 Aug 2002
Posts: 117
Location: Lewes, U.K.

PostPosted: Thu Aug 13, 2009 9:27 pm    Post subject: Reply with quote

Thanks, your the man! Worked first time. The function names are a bit strange as they are "decorated". I have no idea what that means but I used http://www.dependencywalker.com/ to find the real function names.

Here's the test code
Code:

loadlib e:\midictrl\midictrl.dll
%a = @lib(midictrl.dll,@chr(63)MidiGetNumDevices@chr(64)@chr(64)YAK@chr(95)N@chr(64)Z,INT:,BOOL:TRUE)
%b = @lib(midictrl.dll,@chr(63)MidiGetDeviceName@chr(64)@chr(64)YAPBD@chr(95)NK@chr(64)Z,STR:,BOOL:TRUE,INT:0)
freelib e:\midictrl\midictrl.dll
exit

Thanks

David..

P.S. Did you ever write "The art of API programming with VDS 5". I would like to read it if you did.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group