Solved

Determine if DLL is available

Posted on 2006-06-09
6
514 Views
Last Modified: 2012-05-07
Hi,

    When using APIs' how can i determine via VB or VBA whether a PC has a particular DLL loaded/registered (i.e useable)?

     For example;

          If i used the API function  

            "Function KillTimer Lib "user32" Alias "KillTimer" (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long"

         How can i determine if user32.dll is available and can be used on the PC containing the function?

  Cheers
0
Comment
Question by:janoxley
6 Comments
 
LVL 29

Expert Comment

by:nffvrxqgrcfqvvc
ID: 16873894
Well user32,kernel32 etc.. will always be there as the are core system files. Unless on a 16 bit system than its User.dll

You can check an API supported OS on microsoft website

http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/windowing/timers/timerreference/timerfunctions/killtimer.asp
Scroll down to Function Information
0
 
LVL 13

Accepted Solution

by:
iHadi earned 250 total points
ID: 16874460
Hi

Try the following code:
-------------------------------------------------------
Public Function IsRegistered(ByVal class As String) As Boolean
On Error Goto NotRegistered
Dim obj As Object
Set obj = CreateObject(class)
IsRegistered = True
Exit Function
NotRegistered:
End Function
'-------------------------------------------------------

Example Usage:

'-------------------------------------------------------
If Not IsRegistered("Excel.Application") Then
MsgBox "Excel is not installed/registered."
Else
MsgBox "Excel is installed & registered."
End If
'-------------------------------------------------------
' Source url: http://experts.about.com/q/Visual-Basic-1048/DLL-OCX-Registered.htm
0
 
LVL 1

Assisted Solution

by:ciao
ciao earned 250 total points
ID: 16879230
You can call LoadLibrary Api and check return value, if it is false the Api isn't avaible.
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question