Hi friends-VBForums
Results 1 to 31 of 31

Thread: Hi friends

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2017
    Posts
    14

    Hi friends

    Someone knows, how I can register the controls ocx in syswow64 without using cmd?

  2. #2
    PowerPoster
    Join Date
    Oct 2013
    Posts
    2,762

    Re: Hi friends

    Did you copy them manually??

  3. #3
    PowerPoster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    2,863

    Re: Hi friends

    Quote Originally Posted by Andy Master View Post
    Someone knows, how I can register the controls ocx in syswow64 without using cmd?
    You could put the command in a .bat file and register it by shelling it.
    In order to understand recursion, one must first understand recursion….

  4. #4
    Lively Member
    Join Date
    Aug 2017
    Location
    South Africa (in the middle)
    Posts
    83

    Re: Hi friends

    Quote Originally Posted by TysonLPrice View Post
    You could put the command in a .bat file and register it by shelling it.
    Name:  Image 018.png
Views: 108
Size:  3.2 KB

    This is how my .bat file looks like.

    I use the bat name: !!! aaa vb Add Control.bat
    Then a space and then the control name, enter.

    But an easier method, is this (wrote it now just for you, but we all can use it! ) :
    Name:  Image 019.png
Views: 110
Size:  11.0 KB

    Here's the layout:
    Name:  Image 020.png
Views: 107
Size:  4.3 KB

    and the code:
    Code:
    Private Sub Command1_Click()
    
       xx = Shell("regsvr32.exe" + " " + Chr$(34) + Text1.Text + Chr$(34), vbNormalFocus)
    
    End Sub
    Sometimes it took long to copy the path and the name of the file, but you can use a little program like this (Myself):
    The program:
    Name:  Image 021.png
Views: 109
Size:  6.6 KB

    The code:
    Code:
    Dim PaD$
    Private Sub Dir1_Change()
       File1.Path = Dir1.Path
       TeX.Text = Dir1
       
       If Right$(Dir1, 1) = "\" Then
          PaD$ = Dir1
       Else
          PaD$ = Dir1 + "\"
       End If
    End Sub
    
    Private Sub Drive1_Change()
    
       Dir1.Path = Drive1.Drive
    
    End Sub
    
    Private Sub File1_Click()
    
       TeX.Text = PaD$ + File1
    
    End Sub
    
    Private Sub TeX_Click()
    
       If Che.Value = 1 Then
          TeX.SetFocus
          TeX.SelStart = 0
          TeX.SelLength = Len(TeX.Text)
          SendKeys "^C"
       End If
    
    End Sub
    Hope it helps
    Last edited by Inside; Aug 10th, 2017 at 09:36 AM. Reason: Add date of 1st program:
    Programmers are very patient people....while programming....but don't expect them to be patient all the time

  5. #5
    PowerPoster
    Join Date
    Oct 2013
    Posts
    2,762

    Re: Hi friends

    Normally you don't need to register a component which is located in syswow64. :-/

  6. #6
    PowerPoster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    2,863

    Re: Hi friends

    Quote Originally Posted by Arnoutdv View Post
    Normally you don't need to register a component which is located in syswow64. :-/
    That depends on how it got there.
    In order to understand recursion, one must first understand recursion….

  7. #7

    Thread Starter
    New Member
    Join Date
    Aug 2017
    Posts
    14

    Re: Hi friends

    Thanks friends, I really have used CMD, but it takes long time....
    I have Windows 10 64 bits, in cmd, it takes a lot of time listing to give permissions, I do not know if there is any other way, other than using cmd, I takes one minute but in other pcs, could be takes more...
    My recent code in vb6 with cmd for to do it is this...

    Code:
    Public Function RegistrarOcxDllWin64(ByVal Hwnd As Long, Optional ByRef DireccionD As Variant) As Boolean
    On Error Resume Next
    If Not EsMatriz(DireccionD) Then
        If DireccionD = "" Then GoSub AgregarDD
    End If
    
    Dim C As String
    Dim Direccion As String, I As Long, NR As Integer
    
    SendMessage Hwnd, BCM_SETSHIELD, 0&, 1&
    
    'Concatenar C, "/Q", True
    Concatenar C, "@echo off", True
    Concatenar C, "IF ERRORLEVEL 2 GOTO ERROR", True
    Concatenar C, "takeown /f " & LeerRutaEspecial(WindowsCarpetaIni, True, "SysWOW64") & " /r /d s", True
    Concatenar C, "icacls " & LeerRutaEspecial(WindowsCarpetaIni, True, "SysWOW64") & " /grant Administradores:F /t", True
    
    If EsMatriz(DireccionD) Then
        For I = LBound(DireccionD) To UBound(DireccionD)
            If DireccionD(I) = "" Then GoTo S1
        Direccion = DireccionD(I)
        GoSub AgregarC
        SumVar NR
    S1:
    
        Next I
    Else
        If Direccion = "" Then GoTo S2
    Direccion = CStr(DireccionD)
    GoSub AgregarC
    SumVar NR
    S2:
    End If
    
    
    If NR < 1 Then Exit Function
    Concatenar C, "CD " & LeerRutaEspecial(WindowsCarpetaIni, True, "System32\"), True
    
    If EsMatriz(DireccionD) Then
        For I = LBound(DireccionD) To UBound(DireccionD)
        Direccion = DireccionD(I)
        GoSub AgregarR
        Next I
    Else
    Direccion = DireccionD
    GoSub AgregarR
    End If
    
    Concatenar C, "EXIT", True
    Concatenar C, ":ERROR", True
    
    EscribirArchivo C, DirAct(True) & "ACMDExt.bat"
    
    Dim H2 As Long
    H2 = ShellExecute(Hwnd, "runas", DirAct(True) & "ACMDExt.bat", "", CurDir$(), vbHide)
    
    I = 0
    Do While ExisteProceso("CMD.EXE")
    Sleep 1000
    SumVar I
        If I >= 120 Then Exit Do
    Loop
    Dim NC As Long ' Numero de Comprobaciones
    
    If EsMatriz(DireccionD) Then
        For I = LBound(DireccionD) To UBound(DireccionD)
        Direccion = DireccionD(I)
    
            If ExisteAC(LeerRutaEspecial(WindowsCarpetaIni, True, "SysWOW64\") & SNA(Direccion)) Then SumVar NC
    
        Next I
    Else
        Direccion = DireccionD
        If ExisteAC(LeerRutaEspecial(WindowsCarpetaIni, True, "SysWOW64\") & SNA(Direccion)) Then SumVar NC
        
    End If
    
    If NR = NC Then RegistrarOcxDllWin64 = True
    EliminarArchivo DirAct(True) & "ACMDExt.bat", True
    
    Exit Function
    AgregarC:
    Concatenar C, "CD " & SoloPath(Direccion), True
    Concatenar C, "Copy " & SNA(Direccion) & " " & LeerRutaEspecial(WindowsCarpetaIni, True, "SysWOW64\ /Y"), True
    Return
    AgregarR:
    Concatenar C, "regsvr32.exe /S " & LeerRutaEspecial(WindowsCarpetaIni, True, "SysWOW64\" & SNA(Direccion)), True
    Return
    AgregarDD:
    Dim UDD As Long
    UDD = -1
    Agregar:
    GoSub AgregarDDD
    
    DireccionD(UDD) = OpenDialog(, "Ocx o Dll|*.Ocx;*.Dll", "Registrar ocx o dll")
    
    If DireccionD(UDD) = "" And UDD < 1 Then Exit Function
    If DireccionD(UDD) = "" Then
    ReDim Preserve DireccionD(UDD - 1): SumVar UDD, -1
    Else
        If Msg("¿Quiere agregar otra ocx o dll a registrar?", vbQuestion + vbYesNo, "Agregar otra dll u ocx") = vbYes Then GoTo Agregar
    End If
    
    Ya:
    Return
    
    AgregarDDD:
    If UBound(DireccionD) < 0 Then
    ReDim DireccionD(0)
    Else
    ReDim Preserve DireccionD(UDD + 1)
    End If
    
    UDD = UBound(DireccionD)
    
    Return
    
    End Function
    I have made other functions like Concatenar, SumVar, Leerrutaespecial, many months ago...
    But I need to know, how to register the ocx with admin permissions with vb6 only

    I hope that my code helps you understand me, and if it works for you, I would like that too.
    Sorry for my English
    Greetings.

  8. #8
    Lively Member
    Join Date
    Aug 2017
    Location
    South Africa (in the middle)
    Posts
    83

    Re: Hi friends

    The register Control program I written yesterday, here it is in after I modified it a bit:

    !Control Register JJ.zip
    Last edited by Inside; Aug 11th, 2017 at 02:39 AM. Reason: Twiddle mouse clicks go wrong :D
    Programmers are very patient people....while programming....but don't expect them to be patient all the time

  9. #9
    PowerPoster
    Join Date
    Oct 2013
    Posts
    2,762

    Re: Hi friends

    @Andy Master, why not use a normal installer instead of copying and registering OCX files yourself?
    This can really mess up someones installation.

  10. #10

    Thread Starter
    New Member
    Join Date
    Aug 2017
    Posts
    14

    Re: Hi friends

    Thanks Inside, but it doesn't work in my windows 10 64 bits, but I appreciate your help.

    In previous versions of windows this worked fine.

    I have a PC with WinXP and this one with Win10.

    I am seeing many changes now with this windows 10, since I had always used windows xp, but I will have to keep investigating until I find a faster solution.

    Thanks a lot again.

  11. #11

    Thread Starter
    New Member
    Join Date
    Aug 2017
    Posts
    14

    Re: Hi friends

    Hi Arnoutdv.
    I do not know how to use the msi installer with my programs, if you can explain how to do it I would greatly appreciate it.

  12. #12
    Lively Member
    Join Date
    Aug 2017
    Location
    South Africa (in the middle)
    Posts
    83

    Re: Hi friends

    Quote Originally Posted by Andy Master View Post
    Thanks Inside, but it doesn't work in my windows 10 64 bits, but I appreciate your help.
    Strange... I only use windows 10 64...

    You can:
    [folder where VB6 is installed]\VB6.EXE RClick and set Properties:
    Name:  Image 029.png
Views: 81
Size:  19.4 KB
    Last edited by Inside; Aug 12th, 2017 at 02:24 AM.
    Programmers are very patient people....while programming....but don't expect them to be patient all the time

  13. #13
    PowerPoster
    Join Date
    Oct 2013
    Posts
    2,762

    Re: Hi friends

    I assume it's not for your own PC, so you really should use an installer or switch to Side-by-Side installations.
    Otherwise you are going to ruin some windows installations

  14. #14

    Thread Starter
    New Member
    Join Date
    Aug 2017
    Posts
    14

    Re: Hi friends

    Name:  Captura2.jpg
Views: 69
Size:  18.4 KB

    I wanted to register that ocx but I have problems with it Inside, but I tried it with your program and compatibility Win-XP-SP3, but it seems more dificult hehe.

    Name:  Captura.PNG
Views: 69
Size:  13.5 KB

    Could any API work with it?

    I need to do an installer for my program

    Anyway Thanks for your help Inside.

  15. #15
    PowerPoster
    Join Date
    Oct 2013
    Posts
    2,762

    Re: Hi friends

    Use the Package & Deployment Wizard which comes with VB6

  16. #16

    Thread Starter
    New Member
    Join Date
    Aug 2017
    Posts
    14

    Re: Hi friends

    Name:  Captura.PNG
Views: 59
Size:  30.6 KB

    Hi Arnoutdv, I used it, but error again , Do you have an idea of ​​why this happens?

  17. #17
    PowerPoster
    Join Date
    Oct 2013
    Posts
    2,762

    Re: Hi friends

    Are you somehow using controls in your project which are not registered on your computer??

  18. #18
    Lively Member
    Join Date
    Aug 2017
    Location
    South Africa (in the middle)
    Posts
    83

    Re: Hi friends

    Something strange with my program:

    It does not register some controls when I run it while it's compiled, but register all controls so far when I only run it from the VB design "RUN" / F5.

    Why? I do not know...
    Programmers are very patient people....while programming....but don't expect them to be patient all the time

  19. #19
    PowerPoster
    Join Date
    Oct 2013
    Posts
    2,762

    Re: Hi friends

    I think your IDE is running with elevated rights and the created executable is not.

  20. #20

    Thread Starter
    New Member
    Join Date
    Aug 2017
    Posts
    14

    Re: Hi friends

    Hi Arnoutdv and Inside, I guess the control is registered by this...
    Name:  C1.jpg
Views: 42
Size:  37.8 KB

    But then I see that the control is not found automatically in syswow64...
    Name:  C2.PNG
Views: 42
Size:  13.9 KB

    I don't understand well...

  21. #21
    PowerPoster
    Join Date
    Oct 2013
    Posts
    2,762

    Re: Hi friends

    I think you already have a messed up system.
    Having the control in multiple folders is not okay.
    The C:\Windows\SysWow64\mscomctl.ocx looks the like the valid location and is the registered version.

    Where does the second screenshot (with the OCX located in ..\Documents\..) come from?
    Is it a different project??

  22. #22

    Thread Starter
    New Member
    Join Date
    Aug 2017
    Posts
    14

    Re: Hi friends

    Yes it is different project, but I thought that was automatic detection of the only registered mscomctl.ocx

  23. #23

    Thread Starter
    New Member
    Join Date
    Aug 2017
    Posts
    14

    Re: Hi friends

    One project was from "Inside" and the other is "my project"

  24. #24
    PowerPoster
    Join Date
    Oct 2013
    Posts
    2,762

    Re: Hi friends

    The you really should not touch the version in ..\documents\.. , you are really going to ruin your system!

  25. #25

    Thread Starter
    New Member
    Join Date
    Aug 2017
    Posts
    14

    Re: Hi friends

    Yes I understand you, that is why I copied the ocx files to SysWOW64 for to register them, like said that page...
    https://support.microsoft.com/es-mx/...error-messages

  26. #26

    Thread Starter
    New Member
    Join Date
    Aug 2017
    Posts
    14

    Re: Hi friends

    also that is why, I don't understand it:
    Name:  C2.PNG
Views: 39
Size:  13.9 KB

  27. #27
    PowerPoster
    Join Date
    Oct 2013
    Posts
    2,762

    Re: Hi friends

    If you installed VB6 property then there is already a correct and registered version of MSCOMCTL.OCX in the correct location.
    What are you doing with these system OCX files that you are copying them around??

  28. #28
    PowerPoster
    Join Date
    Feb 2006
    Posts
    17,204

    Re: Hi friends

    If MSComCtl.ocx is to be successfully installed, it must be installed into C:\Windows\System32 though if your system root is different it might be another drive letter and "Windows" could be named something else.

    This is spelled out in MSComCtl.dep:

    Code:
    ; Dependency file for setup wizards.
    
    [Version]
    Version=6.1.97.82
    
    ; Dependencies for MSComCtl.ocx
    
    ; Default Dependencies ----------------------------------------------
    
    [MSComCtl.ocx]
    Dest=$(WinSysPath)
    Register=$(DLLSelfRegister)
    Version=6.1.97.82
    Uses1=ComCat.dll
    Uses2=
    CABFileName=MSComCtl.cab
    CABDefaultURL=http://activex.microsoft.com/controls/vb6
    CABINFFile=MSComCtl.inf
    
    [ComCat.dll]
    Dest=$(WinSysPathSysFile)
    Register=$(DLLSelfRegister)
    Uses1=
    :
    :
    Any 32-bit installer, whether a PDW Setup or an Installer MSI package, will automatically deal with Win64 issues via the file redirection (Wow64FsRedirection) feature in Windows.

    The installer must run elevated, and it should be responsible for registering an installed OCX. Registry redirection takes care of any x64 issues here as well.


    Trying to stuff these kinds of files onto a non-system drive (much less a network share - I cringe at the thought) is a recipe for disaster even if you somehow manage to get it to work. That isn't a supported configuration even when using Activation Context manifests unless each such file has been marked to run from swap memory, and even then it is only meant for something like an installer. But if you try to register such files in a funky location you do indeed risk breaking other applications.


    You are breaking too many rules and it has bit you in the rear. People got themselves into deep trouble trying tricks like always logging on as an Administrators or Power Users user so they could pretend they were still on Windows 95. This left machines very insecure, so after XP we got UAC and the elimination of Power Users to help secure PCs for people who have these bad habits.

    It sounds like you have now managed to break your development PC as well.

    Trying to go from 2001's Windows XP used in "pretend we still use Windows 95 mode" to 2015's Windows 10 in one jump was bound to give you fits. You are trying to program from a perspective that is now over 20 years behind the times. You have a lot of bad habits to unlearn, and some 20 years of changes to learn.

    I just don't know how we can help you. You have pulled out onto a freeway in a horse-drawn carriage. VB6 is not a "beginner's language" but a tool for professionals. That is exactly why after such a very bad experience with VB5 Microsoft eliminated the "Standard Edition" previously sold to hobby users.
    Last edited by dilettante; Aug 15th, 2017 at 07:02 AM.

  29. #29

    Thread Starter
    New Member
    Join Date
    Aug 2017
    Posts
    14

    Re: Hi friends

    If I understand those bad habits for that very reason I want to correctly register the activex controls in their correct folders, but it turns out that when I wanted to run a program made in vb6 here in Windows 10, this one did not run and I did not know how to do an installer, it is So I asked for help to be told how to do a normal installer too.

  30. #30
    PowerPoster
    Join Date
    Oct 2013
    Posts
    2,762

    Re: Hi friends

    Then why do you try to register the OCX from such a strange location?
    Based on your IDE screenshot the control is already registered from within the correct location.

  31. #31

    Thread Starter
    New Member
    Join Date
    Aug 2017
    Posts
    14

    Re: Hi friends

    No!, I have never registered that control in this location, but I thinking why it takes this location....

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.