Solved

Registering dlls and ocxs with a patcher

Posted on 2002-04-18
14
228 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 3
  • +2
14 Comments
 
LVL 70

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
Technology Partners: 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!

 

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 70

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 70

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
 
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 70

Expert Comment

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

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Using "ScreenUpdating" 6 88
Access Object Property from VBA Module in Excel 2010 2 45
VBA: loop recent folder and copy txt file. 8 56
transition to visual .net from vb6 5 81
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

752 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