Solved

Registering dlls and ocxs with a patcher

Posted on 2002-04-18
14
217 Views
Last Modified: 2010-05-02
I have a patcher program that goes out to a patch servers, grabs files, and copies them to a client's machine.  This patcher is ran from the client.  What I want to do is if the file being copied is a dll or ocx, I want to register it on the client's system.  Can someone show me how to do this inside of a vb project?  Remember, this could be on a machine of someone who does not have any controls at all.

Thanks.
0
Comment
Question by:midavis
  • 5
  • 3
  • 3
  • +2
14 Comments
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 6952469
I have that kind of app too and I use this method:

1. I distribute regsvr32.exe with my patch.
2. I run this code:

strExtension = UCase$(Trim$(Right$(.strFileName, 4)))
If strExtension = ".DLL" Or strExtension = ".OCX" Then
   If Not WaitForProcessToEnd(App.Path & "\REGSVR32 /s " & Chr(34) & strDestination & Chr(34)) Then Exit Function
End If



Declare Function WaitForSingleObject _
                 Lib "kernel32" _
                 (ByVal hHandle As Long, _
                 ByVal dwMilliseconds As Long) As Long
Declare Function OpenProcess _
                 Lib "kernel32" _
                 (ByVal dwDesiredAccess As Long, _
                 ByVal bInheritHandle As Long, _
                 ByVal dwProcessId As Long) As Long
Public Const INFINITE = &HFFFF

Private Function WaitForProcessToEnd(ByVal pstrExecute As String) As Boolean
Dim lngHandle As Long
Dim lngProcessID As Long
Dim lngReturnValue As Long

    On Error GoTo ErrorHandler
   
    WaitForProcessToEnd = False
   
    lngProcessID = Shell(pstrExecute)
    lngHandle = OpenProcess(&H100000, True, lngProcessID)
    lngReturnValue = WaitForSingleObject(lngHandle, INFINITE)
   
    WaitForProcessToEnd = True
   
'Une seule porte de sortie pour la procédure
GoHere:
    Exit Function
   
'Traitement des erreurs
ErrorHandler:
    Select Case Err.Number
        Case 53  'File not found
            MsgBox "Le fichier REGSVR32.EXE n'est pas présent dans le répertoire de l'application de Gestion des versions." & vbCrLf & vbCrLf & _
                   "Avisez le service à la clientèle.", vbOKOnly + vbCritical
            Resume GoHere
        Case Else
            MsgBox Err.Number & " : " & Err.Description
            Resume GoHere
    End Select
End Function
0
 
LVL 1

Expert Comment

by:falconew
ID: 6952651
ping
0
 
LVL 2

Expert Comment

by:corvanderlinden
ID: 6952792
>> Remember, this could be on a machine of someone who does not have any controls at all.

Just to remind you that your clients need the vb runtime
0
 

Author Comment

by:midavis
ID: 6953830
The client may not have the vb runtime.  Probably 95% of the clients who get this will not have the vb runtime.
0
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 6953848
you were requesting for a patcher!

To install the application, use the Package & Deployment wizard that comes with VB. It will create a setup package that will includes everything required to run your application.
0
 

Author Comment

by:midavis
ID: 6954063
This is for a patcher.  Clients will get a full version, but the question is for any updates using this patcher.  If I want to give them a new dll or ocx with a new version I have found that regsvr32.exe does not always register correctly.  I am wondering if there is another way to do this.
0
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 6954461
>> I have found that regsvr32.exe does not always register correctly

All DLLs are not COM. Those that are COM are ALWAYS registered correctly.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 2

Expert Comment

by:corvanderlinden
ID: 6959023
If you give a new ActiveX that is not binary compatible with the previous ActiveX your in trouble anyway
If it's binary compatible (if the interface DID NOT change) you can just copy without registering. I've done this a lot and it works just perfectly

0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6961409
midavis->  I have posted details in all your open questions, please update and finalize them.  Some are very old and have been inactive for months, despite help given.
Thanks,
Moondancer - EE Moderator
0
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 6985013
any progress?
0
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 7060654
This question appears to be abandoned. A question regarding it will be left in the Community Support
area; if you have any comment about the question, please leave it here.

Unless there is objection or further activity, one of the moderators will be asked to accept the comment
of <emoreau>.

The link to the Community Support area is:
http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt

DO NOT ACCEPT THIS COMMENT AS AN ANSWER.
0
 

Author Comment

by:midavis
ID: 7061952
No answers were given to register a dll on a machine that may not have vb components.
0
 
LVL 1

Accepted Solution

by:
Moondancer earned 0 total points
ID: 7065805
You have pended this question for deletion, but unfortunately, once comments have been added, you cannot delete a question without Moderator assistance.

I have refunded to you, 50 points for this and moved it to our PAQ and closed it.  Sorry, experts.

Moondancer - EE Moderator
0
 
LVL 2

Expert Comment

by:corvanderlinden
ID: 7066520
>>No answers were given to register a dll on a machine that may not have vb components

You may be able to register it, but you cannot use it without the VB runtime
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

914 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

12 Experts available now in Live!

Get 1:1 Help Now