+ Reply to Thread
Results 1 to 3 of 3

DLL's explained?

  1. #1
    Valued Forum Contributor Macdave_19's Avatar
    Join Date
    03-14-2007
    Location
    Birmingham, England
    MS-Off Ver
    12.0
    Posts
    808

    Question DLL's explained?

    Hi everyone,

    Im trying to read up on DLL's and how to call upon them etc etc. i was wondering if there were some simple DLL's that i could call up to practice a little and what each one actually show's I.E "advapi32.dll" can be used to obtain the username of the person logged onto the computer.

    any others that may offer simple info etc?

    any help is much appreciated!!
    Mr MaGoo
    Magoo.Inc MMVII

    If i've helped please add to my Rep by Clicking on the Blue Scales in the top right hand corner of the post

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Macdave_19,

    While understanding the structure of a DLL (Data Link Library) is helpful, you will need more detailed information on the API calls the DLL contains. API calls don't have intellisense like VBA to show you what the argument name and type are. Incorrectly calling an API function can easily crash the computer.

    It helps to have an understanding of "C", since most DLL are written in "C". You need to understand "C" variable types and their VB counterparts, or the function will fail. Since DLL are executable files (compiled), you really can't view the contents.

    The basic format for call a DLL is...
    Private, Public - default is Public
    Declare - Tells VB this a DLL Function or Sub
    Function, Sub - 99% of DLL return values. If a value is returned use Function, otherwise Sub.
    <DLL name> - Names are case sensitive (string)
    Lib - The DLL library name (string)
    [Alias] - The DLL name. Use this option when the name conflicts with a VB keyword, or you want the name to be more understandable. This allows you to use a different name after the Function or Sub.
    <name As type> - Arguments are enclosed in parentheses and separated by commas. Arguments can be called ByRef or ByVal, if omitted the default is ByRef

    Here are 2 Simple API calls to help illustrate their use. To use these be located in a Standard VBA Module, and made Public if they are to be called from outside the module they are in.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross
    Last edited by Leith Ross; 02-01-2008 at 03:16 PM.

  3. #3
    Valued Forum Contributor Macdave_19's Avatar
    Join Date
    03-14-2007
    Location
    Birmingham, England
    MS-Off Ver
    12.0
    Posts
    808

    Cheers

    Cheers for the help Leith it's much appreciated, maybe i should look into starting "C"!!

    Cheers once again!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1