I've never found a need, but some of you may want to know whether or not a DLL is an ActiveX type DLL, or a standard API driven one. Possibly useful if you are writing your own setup/installation apps...

VB Code:
  1. Option Explicit
  2.  
  3. Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long
  4. Private Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, _
  5.                                                         ByVal lpProcName As String) _
  6.                                                         As Long
  7. Private Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long
  8.  
  9. Private Sub Command1_Click()
  10.  
  11.     MsgBox IsAXDLL("C:\Users\Project1.dll") 'A DLL written in VB (Active X), returns True
  12.     MsgBox IsAXDLL("C:\WINNT\SYSTEM32\testdll.dll") 'A DLL written in C (standard), returns False
  13.  
  14. End Sub
  15.  
  16. Private Function IsAXDLL(ByVal sFileName As String) As Boolean
  17. Dim hModule As Long
  18.  
  19.     If Not FileExists(sFileName) Then Exit Function
  20.  
  21.     hModule = LoadLibrary(sFileName)
  22.    
  23.     If hModule Then
  24.         IsAXDLL = (GetProcAddress(hModule, "DllRegisterServer") <> 0&)
  25.         Call FreeLibrary(hModule)
  26.     End If
  27.  
  28. End Function
  29.  
  30. Private Function FileExists(ByVal s As String) As Boolean
  31.     FileExists = ((Len(s) > 0) And (Len(Dir$(s)) > 0))
  32. End Function


The code could still use some work. As you can see, it will return False if something goes wrong while calling LoadLibrary. But that doesn't always mean that the DLL isn't an ActiveX one.