Solved

Determine if DLL is available

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

766 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