Solved

Registering dlls and ocxs with a patcher

Posted on 2002-04-18
14
216 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
Comment Utility
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
Comment Utility
ping
0
 
LVL 2

Expert Comment

by:corvanderlinden
Comment Utility
>> 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
>> 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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 2

Expert Comment

by:corvanderlinden
Comment Utility
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
Comment Utility
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
Comment Utility
any progress?
0
 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
>>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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

763 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

13 Experts available now in Live!

Get 1:1 Help Now