Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / Win API / September 2003



Tip: Looking for answers? Try searching our database.

check if the dll is registerd or not

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
prash - 30 Sep 2003 03:59 GMT
hello there

Does any one know how to get the information of a dll where it is registered
in the system or not

Thanks in advance
PRashantha
Klaus H. Probst - 30 Sep 2003 04:43 GMT
As long as you know at least one ProgID, you can do this:

Private Type CLSID          '// GUID
   Data1 As Long
   Data2 As Integer
   Data3 As Integer
   Data4(0 To 7) As Byte
End Type

'// Possible errors
Private Const E_INVALIDARG                     As Long = &H80070057
Private Const E_UNEXPECTED                     As Long = &H8000FFFF
Private Const CO_E_CLASSSTRING                 As Long = &H800401F3
Private Const E_OUTOFMEMORY                    As Long = &H8007000E
Private Const REGDB_E_WRITEREGDB               As Long = &H80040151

Private Declare Function CLSIDFromProgID Lib "ole32" (ByVal lpszProgID As
String, pclsid As CLSID) As Long

'
'
'
Private Function IsProgIDRegistered(ByVal strProgID As String) As Boolean

   '// a ProgID goes something like this: "MSComctlLib.Slider". Passing a
   '// bogus value or a non-registered class will return FALSE

   Dim pclsid As CLSID
   Dim hResult As Long

   On Error Resume Next

   hResult = CLSIDFromProgID(StrConv(strProgID, vbUnicode), pclsid)
   IsProgIDRegistered = (hResult = 0)

End Function

And then call it like so:

Private Sub Form_Load()

   Debug.Print IsProgIDRegistered("ADODB.Recordset")
   Debug.Print IsProgIDRegistered("Some.BogusProgid")
   Debug.Print IsProgIDRegistered("MSXML2.DOMDocument")

End Sub

Signature

____________________
Klaus H. Probst, MVP
  http://www.vbbox.com/

Please post/reply to the newsgroup(s)

> hello there
>
[quoted text clipped - 4 lines]
> Thanks in advance
> PRashantha
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.