Solved

Determine if DLL is available

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
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…

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now