Solved

Determine if DLL is available

Posted on 2006-06-09
6
533 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Suggested Solutions

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…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

726 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