• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 15. USING API CALLS TO EXTEND TH... > LOOKING AT SOME EXAMPLES OF API CALL...

LOOKING AT SOME EXAMPLES OF API CALLS

It's time now for some real examples. The rest of this chapter will look at some actual examples of API calls being used. Before jumping into the individual examples, however, look again at the API declarations used for all of them, merely for your convenience and to refresh them in your mind (see Listing 15.2). These can be found in the module modWindowsAPIRoutines, in Chap15.mdb.

Listing 15.2. Chap15.mdb: Declaring API Calls

Option Compare Database
Option Explicit

'-- API Call for finding the associated file
Declare Function wu_FindExecutable Lib "shell32.dll" Alias _
   "FindExecutableA" (ByVal lpFile As String, _
   ByVal lpDirectory As String, ByVal lpResult As String) As Long

'-- API Calls for adding and cancelling network connection
'-- programmatically
Declare Function wu_NetAddConnection Lib "mpr" Alias _
   "WNetAddConnectionA" (ByVal NetPath$, ByVal Password$, _
   ByVal LocalDrive$) As Integer
Declare Function wu_NetCancelConnection Lib "mpr" Alias _
   "WNetCancelConnectionA" (ByVal NetPath$, ByVal FileForce%) _
   As Integer

'-- API Calls for calling the network connect and
'-- disconnect dialogs
Declare Function wu_WNetConnectionDialog Lib "mpr" Alias _
   "WNetConnectionDialog" (ByVal hwnd As Long, ByVal dwType As Long) _
   As Long
Declare Function wu_WNetDisconnectDialog Lib "mpr" Alias _
   "WNetDisconnectDialog" (ByVal hwnd As Long, _
   ByVal dwType As Long) As Long

'-- API Calls for getting the current user and computer names
Declare Function wu_GetUserName Lib "advapi32.dll" Alias _
   "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) _
   As Long
Declare Function wu_GetComputerName Lib "kernel32" Alias _
   "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) _
   As Long

'-- API Calls for getting the windows, system, and temp directory for
'-- the current computer.
Declare Function wu_GetWindowsDirectory Lib "kernel32" Alias _
   "GetWindowsDirectoryA" (ByVal lpBuffer As String, _
   ByVal nSize As Long) As Long
Declare Function wu_GetSystemDirectory Lib "kernel32" Alias _
   "GetSystemDirectoryA" (ByVal lpBuffer As String, _
   ByVal nSize As Long) As Long
Declare Function wu_GetTempPath Lib "kernel32" Alias _
   "GetTempPathA" (ByVal nBufferLength As Long, _
   ByVal lpBuffer As String) As Long


					  


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint