• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 234
  • Last Modified:

Registering dlls and ocxs with a patcher

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
midavis
Asked:
midavis
  • 5
  • 3
  • 3
  • +2
1 Solution
 
Éric MoreauSenior .Net ConsultantCommented:
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
 
falconewCommented:
ping
0
 
corvanderlindenCommented:
>> 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
midavisAuthor Commented:
The client may not have the vb runtime.  Probably 95% of the clients who get this will not have the vb runtime.
0
 
Éric MoreauSenior .Net ConsultantCommented:
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
 
midavisAuthor Commented:
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
 
Éric MoreauSenior .Net ConsultantCommented:
>> 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
 
corvanderlindenCommented:
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
 
MoondancerCommented:
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
 
Éric MoreauSenior .Net ConsultantCommented:
any progress?
0
 
Éric MoreauSenior .Net ConsultantCommented:
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
 
midavisAuthor Commented:
No answers were given to register a dll on a machine that may not have vb components.
0
 
MoondancerCommented:
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
 
corvanderlindenCommented:
>>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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 5
  • 3
  • 3
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now