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 


Define DLL calls

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Other Product Support/Announcements
View previous topic :: View next topic  
Author Message
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Sat Sep 06, 2003 7:11 pm    Post subject: Define DLL calls Reply with quote

Hello all,

I've made a little tool to easily add API functions into your VDS 5 program. You only have to fill in the fields, and press the "Generate" button. Then paste it into VDS, so you can call the functions by only mentioning the name, without all the @lib() headers. You can download it [ here ].

Example (from Microsoft's MSDN):

Code:
int MessageBoxA(
    HWND hWnd,
    LPCTSTR lpText,
    LPCTSTR lpCaption,
    UINT uType
  );


After inserting the above into my tool, you get this:

Code:
#define function,MessageBoxA

:MessageBoxA
exit @lib(user32.dll,MessageBoxA,INT:,INT:@strdel(@winexists(@dlgtext()),1,1),STR:%1,STR:%2,INT:%3)


Then just copy the #define line to the top of your file, and the lines below to the bottom of your script, and it is ready to be called.

Example:

Code:
#define function,MessageBoxA

  DIALOG CREATE,New Dialog,-1,0,240,160
  DIALOG SHOW

loadlib user32.dll

%z = @MessageBoxA("Does this work?","Hello world!",4)

if @equal(%z,6)
  info You clicked yes!
  else
  info No? Why not?
  end
 
freelib user32.dll

exit

:MessageBoxA
exit @lib(user32.dll,MessageBoxA,INT:,INT:@strdel(@winexists(@dlgtext()),1,1),STR:%1,STR:%2,INT:%3)

_________________
[ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial!
Back to top
View user's profile Send private message
Serge
Professional Member
Professional Member


Joined: 04 Mar 2002
Posts: 1480
Location: Australia

PostPosted: Sun Sep 07, 2003 12:37 am    Post subject: Reply with quote

looks good and very handy skit

serge

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Sun Sep 07, 2003 11:37 am    Post subject: Reply with quote

Thanks... Smile
_________________
[ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial!
Back to top
View user's profile Send private message
CodeScript
Moderator Team


Joined: 08 Jun 2003
Posts: 1060
Location: India

PostPosted: Sun Sep 07, 2003 12:59 pm    Post subject: Reply with quote

Nice tool Skit Smile
I had a crude model like that for personal use. But not with all the options.
You can cosider the option of entering the parameters in the tool itself.
Also rather than exiting the @LIB function giving a edit box to enter the return value variable is better. Mostly these functions are used/(need) as multiple calls - as far as my lttle experience goes.
Also if run from tools menu you can add option of inserting the #define on the top after scrolling the #TSyntaxMemo to 0,0 and rest at current position. Another thought is autocomplete. Atleast the window API dll names in the first instance. Later on a few thousands Wink of declares like my constant collection.

_________________
Regards
- CodeScript
Arrow Give your application a professional look with the VDSGUI Extension
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Other Product Support/Announcements 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