Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > General Discussion
  New Posts New Posts RSS Feed - Checking if the control is registered
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Checking if the control is registered

 Post Reply Post Reply
Author
Message
farhanzia View Drop Down
Newbie
Newbie
Avatar

Joined: 10 January 2004
Location: Pakistan
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote farhanzia Quote  Post ReplyReply Direct Link To This Post Topic: Checking if the control is registered
    Posted: 10 January 2004 at 7:36am

Hello, is there way I can check if the DockingPane control is registered on a machine. One way to check such things is to try instantiating the control. I tried the following ways but everytime I get an error that ActiveX component can't create object.

Dim objDockingControl As XtremeDockingPane.Pane
Set objDockingControl = CreateObject("XtremeDockingPane.DockingPane")

I tried this also,
Dim objDockingControl As XtremeDockingPane.Pane
Set objDockingControl = New XtremeDockingPane.Pane

And also this
Dim objDockingControl As New XtremeDockingPane.Pane

But all these are throwing the same error that ActiveX component can't create object. Is there any way of checking if the control is already registered on a machine? Any help will be highly appreciated.

Back to Top
Oleg View Drop Down
Admin Group
Admin Group
Avatar

Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 10 January 2004 at 9:19am

 

Dim objDockingControl As Object
Set objDockingControl = CreateObject("DOCKINGPANE.DockingPaneCtrl.1")

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
farhanzia View Drop Down
Newbie
Newbie
Avatar

Joined: 10 January 2004
Location: Pakistan
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote farhanzia Quote  Post ReplyReply Direct Link To This Post Posted: 10 January 2004 at 10:31am

Thanks Oleg, it worked. However after getting that the control is not registered, I tried registering it through code the following way.

Call Shell(regsvr32.exe "C:\MyFolder\DockingPane.ocx", vbHide)

I get the message popped up that registration is successful (though I have used vbHide, but I am still getting the message popped up)

But next when I try to create an object just as I did earlier (the way you have suggested), I got the error that ActiveX component can't create object.

Please let me know how can I register the docking control through code. This will help much. And also any idea how can I hide that registration message that DllReisterServer successded. I tried using vbHide in the shell command but it didn't worked.

Thanks so much for your help.

 

Back to Top
robs View Drop Down
Groupie
Groupie


Joined: 09 November 2003
Status: Offline
Points: 84
Post Options Post Options   Thanks (0) Thanks(0)   Quote robs Quote  Post ReplyReply Direct Link To This Post Posted: 10 January 2004 at 10:36am

farhanzia,

I usualy use something like this. Sorry for the long post.

Private Declare Function LoadLibraryRegister Lib "KERNEL32" Alias "LoadLibraryA" _
    (ByVal lpLibFileName As String) As Long
Private Declare Function FreeLibraryRegister Lib "KERNEL32" Alias "FreeLibrary" _
    (ByVal hLibModule As Long) As Long
Private Declare Function CloseHandle Lib "KERNEL32" (ByVal hObject As Long) As Long
Private Declare Function GetProcAddressRegister Lib "KERNEL32" Alias "GetProcAddress" _
    (ByVal hModule As Long, ByVal lpProcName As String) As Long
Private Declare Function CreateThreadForRegister Lib "KERNEL32" Alias "CreateThread" _
    (lpThreadAttributes As Long, ByVal dwStackSize As Long, ByVal lpStartAddress As Long, _
     ByVal lpparameter As Long, ByVal dwCreationFlags As Long, lpThreadID As Long) As Long
Private Declare Function WaitForSingleObject Lib "KERNEL32" _
    (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Declare Function GetExitCodeThread Lib "KERNEL32" _
    (ByVal hThread As Long, lpExitCode As Long) As Long
Private Declare Sub ExitThread Lib "KERNEL32" (ByVal dwExitCode As Long)
Private Const WAIT_OBJECT_0 = &H0
Private Const NOERRORS As Long = 0

Public Enum stRegisterStatus
    stFileCouldNotBeLoadedIntoMemorySpace = 1
    stNotAValidActiveXComponent = 2
    stActiveXComponentRegistrationFailed = 3
    stActiveXComponentRegistrationSuccessful = 4
    stActiveXComponentUnRegisterSuccessful = 5
    stActiveXComponentUnRegistrationFailed = 6
    stNoFileProvided = 7
End Enum

Public Function Register(ByVal p_sFileName As String) As stRegisterStatus 'Variant
    Dim lLib As Long
    Dim lProcAddress As Long
    Dim lThreadID As Long
    Dim lSuccess As Long
    Dim lExitCode As Long
    Dim lThreadHandle As Long
    Dim lRet As Long
   
    On Error GoTo ErrorHandler
    p_sFileName = Trim(p_sFileName)
   
    If lRet = NOERRORS Then
        If p_sFileName = "" Then
             'error
             lRet = stNoFileProvided
        Else
             lLib = LoadLibraryRegister(p_sFileName)
             If lLib = 0 Then
                 'error
                 lRet = stFileCouldNotBeLoadedIntoMemorySpace
             Else
                 lProcAddress = GetProcAddressRegister(lLib, "DllRegisterServer")
                 If lProcAddress = 0 Then
                     'error
                     lRet = stNotAValidActiveXComponent
                 Else
                     lThreadHandle = CreateThreadForRegister(0, 0, lProcAddress, 0, 0, lThreadID)
                     If lThreadHandle <> 0 Then
                           lSuccess = (WaitForSingleObject(lThreadHandle, 10000) = WAIT_OBJECT_0)
                           If lSuccess = 0 Then
                               'error
                               Call GetExitCodeThread(lThreadHandle, lExitCode)
                               Call ExitThread(lExitCode)
                               lRet = stActiveXComponentRegistrationFailed
                           Else
                               lRet = stActiveXComponentRegistrationSuccessful
                           End If
                     End If
                 End If
             End If
        End If
    End If
   
ExitRoutine:
    Register = lRet
    If lThreadHandle <> 0 Then Call CloseHandle(lThreadHandle)
    If lLib <> 0 Then Call FreeLibraryRegister(lLib)
    Exit Function
   
ErrorHandler:
    lRet = Err.Number
    GoTo ExitRoutine
   
End Function

Back to Top
robs View Drop Down
Groupie
Groupie


Joined: 09 November 2003
Status: Offline
Points: 84
Post Options Post Options   Thanks (0) Thanks(0)   Quote robs Quote  Post ReplyReply Direct Link To This Post Posted: 10 January 2004 at 10:40am

There's an even cleaner one listed on the Extreme Visual Basic Forum at http://visualbasicforum.com/t124982.html

 



Edited by robs
Back to Top
farhanzia View Drop Down
Newbie
Newbie
Avatar

Joined: 10 January 2004
Location: Pakistan
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote farhanzia Quote  Post ReplyReply Direct Link To This Post Posted: 11 January 2004 at 3:24am
Thanks guys. Both these solutions are working but we are at the same problem. The DockingPane.ocx file is getting registered successfully but after that when I am trying creating an instance of the control through code, I am getting the same error that ActiveX component can't create object. This is how I am trying to create the instance.

    Dim objDockingControl As Object
    Set objDockingControl = CreateObject("DOCKINGPANE.DockingPaneCtrl.1")

This code only works if I have installed the complete software. Otherwise just registering the "DockingPane.ocx" file is not working. I am getting the 'ActiveX component can't create object' error on the CreateObject line. Any help in this regards? By registering the "DockingPane.ocx" file, shall I be able to instantiate the "DOCKINGPANE.DockingPaneCtrl.1" class?

Thanks,
Farhan
Back to Top
farhanzia View Drop Down
Newbie
Newbie
Avatar

Joined: 10 January 2004
Location: Pakistan
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote farhanzia Quote  Post ReplyReply Direct Link To This Post Posted: 15 January 2004 at 6:32am

Ok guys, I found a solution to it finally. After registering the ocx file, I was failing to instantiate the class "DOCKINGPANE.DockingPaneCtrl.1" because of the license issue. The license file "DockingPane.lic" has to be at the same path where the ocx is residing while registering. Once you will register in this scenario, you will be able to instantiate the class successfully. That means we need both these 2 files to deploy a software using DockingPane. i.e.

1. DockingPane.ocx
2. DockingPane.lic

I searched the documentation if there is any information available for deployments files, but couldn't find anything related to it. Can somebody confirm if these are the only 2 files needed for deployment?

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0.094 seconds.