Results 1 to 11 of 11

Thread: Calling XP/Vista/Win7 Manifest Creator from VB6 Add-Ins

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2011
    Posts
    49

    Calling XP/Vista/Win7 Manifest Creator from VB6 Add-Ins

    This is 99% LaVolpe's code, based on this thread: http://www.vbforums.com/showthread.php?t=606736

    New feature: Auto replace StartUp Object.

    Special thank's to LaVolpe.



    -
    Attached Files Attached Files

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Calling XP/Vista/Win7 Manifest Creator from VB6 Add-Ins

    If you give this thing a more complete description of what it does, I'll link to it from my project
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3

    Thread Starter
    Member
    Join Date
    Jun 2011
    Posts
    49

    Re: Calling XP/Vista/Win7 Manifest Creator from VB6 Add-Ins

    Before use it, compile and name the component with ManifestCreator.dll
    Click install.bat for registering the addins file.

    How to use:
    1. In your VB6 Application click Add-Ins menu >> click Manifest Creator menu.
    2. Adjust any settings in the Manifest Creator.
    3. Click Create Manifest button. Finish.

    Note:
    When you click the Create Manifest button. This Add-Ins application will automatic:
    1. Adding modManifestResource.bas file.
    2. Adding XP.manifest.res file.
    3. Change your Startup Object to Sub Main, and the code in modManifestResource.bas look like this:
    Code:
        ' Code
        On Error GoTo 0
        '... show your main form next (i.e., Form1.Show)
        frmMain.Show 'assume StartUp Object is frmMain.
        If hMod Then FreeLibrary hMod
        ' Code
    What would happen if you already have:
    1. Sub Main() procedure?,
    2. Resource file do not already have manifest?,
    3. Resource file already have embedded manifest?

    1. Sub Main() procedure will change to Sub OldSubMain() and the code in modManifestResource.bas look like:
    Code:
        ' Code
        On Error GoTo 0
        '... show your main form next (i.e., Form1.Show)
        OldSubMain
        If hMod Then FreeLibrary hMod
        ' Code
    2. The Add-Ins will add manifest and merger it with the existing resource.
    3. The old manifest will be replaced with the new manifest

    Thank's LaVolpe for the very handy tools.

  4. #4
    Member
    Join Date
    Aug 2006
    Posts
    57

    Re: Calling XP/Vista/Win7 Manifest Creator from VB6 Add-Ins

    thanks for share this addin....
    1 rate 4 you bro.........

  5. #5
    Addicted Member
    Join Date
    Mar 2007
    Location
    India
    Posts
    227

    Re: Calling XP/Vista/Win7 Manifest Creator from VB6 Add-Ins

    It is possible to add facility for RegFree way of registering ActiveX DLLs in by this Manifest Creator?

  6. #6

    Thread Starter
    Member
    Join Date
    Jun 2011
    Posts
    49

    Re: Calling XP/Vista/Win7 Manifest Creator from VB6 Add-Ins

    thanks for share this addin....
    1 rate 4 you bro.........

    You are welcome, Mas Bro.

    Quote Originally Posted by yogiyang View Post
    It is possible to add facility for RegFree way of registering ActiveX DLLs in by this Manifest Creator?
    Yes,to make it simple, you can use "Make My Manifest Project", follow step by step as described bellow:

    1. Download MMM (Make My Manifest) source code.http://mmm4vb6.atom5.com/
    2. Open MMM.vbp, in the modMain, replace all code with this:
    Code:
    Option Explicit
    
    '----- Public Data -----
    
    '----- Public Constants -----
    
    '----- Private Methods -----
    
    Sub Main()
        With App
            G_Product_Identity = _
                .ProductName & " " & CStr(.Major) & "." & CStr(.Minor) & "." & CStr(.Revision)
        End With
        G_Product_Settings_Path = GetProductSettingsPath()
        
        If Len(Command$()) > 0 Then
            frmMain.OpenVB6Project Command$
        Else
            'GUI mode.
            AppEx.InitCommonControls
            frmMain.Show vbModeless
        End If
    End Sub
    3. In the frmMain of MMM.VBP replace Private Sub mnuFileOpenVBP_Click() procedure with this:
    Code:
    Private Sub mnuFileOpenVBP_Click()
        OpenVB6Project
    End Sub
    
    Public Sub OpenVB6Project(Optional strVB6Project)
    
        If Not IsMissing(strVB6Project) Then
            G_VBP_FQFileName = strVB6Project
        Else
            G_VBP_FQFileName = GetProjectFile()
        End If
        
        If Len(G_VBP_FQFileName) > 0 Then
            Load frmLog
            mnuViewLog.Enabled = True
            tbrMain.Buttons(GC_TBBTN_LOG).Enabled = True
            
            With frmLog
                .Log G_Product_Identity
                .Log FormatDateTime(Date, vbLongDate) & " @ " & FormatDateTime(Time(), vbLongTime)
                .Log
                .Log "Host OS = Windows " & FormatNumber(AppEx.OSVersion(aioVersion), 2) _
                   & " " & AppEx.OSVersion(aioServicePackString) _
                   & " (Build " & CStr(AppEx.OSVersion(aioBuildNumber)) & ")"
                .Log "Host = " & AppEx.ComputerName
                .Log "User = " & AppEx.UserName
                .Log
                Set G_Product_IniDOM = _
                    IniDOMFromFile(G_Product_Settings_Path & GC_PRODUCT_SETTINGS_FILE)
                If G_Product_IniDOM Is Nothing Then
                    .Log "Missing settings file " & GC_PRODUCT_SETTINGS_FILE
                    MsgBox "Missing settings file " & GC_PRODUCT_SETTINGS_FILE, _
                           vbOKOnly Or vbCritical
                    mnuFileOpenVBP.Enabled = False
                    mnuFileOpenMMMP.Enabled = False
                    tbrMain.Buttons(GC_TBBTN_OPEN).Enabled = False
                    sbMain.SimpleText = "Fatal error: missing " & GC_PRODUCT_SETTINGS_FILE
                Else
                    G_VBP_Path = PathOfFQFileName(G_VBP_FQFileName)
                    G_VBP_FileName = SimpleFileName(G_VBP_FQFileName)
                    Caption = G_VBP_FileName & " - MMM: Make My Manifest"
                    
                    'Create MMM package settings DOM, begin populating Sections.
                    Set G_Package_IniDOM = New IniDOM
                    With G_Package_IniDOM.Sections
                        .Add , "MMM package settings."
                        .Add
                        .Add "MMM"
                        !MMM.Keys.Add "Version", CStr(App.Major) & "." _
                                               & CStr(App.Minor) & ".0." _
                                               & CStr(App.Revision)
                        .Add
                        IniDOMCloneSection "Redist", G_Product_IniDOM, G_Package_IniDOM
                        .Add
                        .Add "VBProject"
                        With !VBProject.Keys
                            .Add "File", G_VBP_FileName
                            .Add "Folder", G_VBP_Path
                        End With
                        .Add
                        .Add "MMMPackage"
                        .Add
                    End With
                    
                    mnuViewProject.Enabled = True
                    tbrMain.Buttons(GC_TBBTN_PROJECT).Enabled = True
                    tbrMain.Buttons(GC_TBBTN_PROJECT).Value = tbrPressed
                    With frmProject
                        .Show 'And Load.
                        .AddProp GPP_PROJPATH, G_VBP_Path
                        .AddProp GPP_VBPROJFILE, G_VBP_FileName
                    End With
                    .Log GPP_PROJPATH & " = " & G_VBP_Path
                    .Log GPP_VBPROJFILE & " = " & G_VBP_FileName
                    .Log
                    
                    sbMain.SimpleText = "Scanning VBP file and dependencies"
                    
                    'Disable Open options.
                    Dim intButtonMenu As Integer
                    
                    With tbrMain.Buttons(GC_TBBTN_OPEN)
                        .Enabled = False
                        For intButtonMenu = 1 To 2
                            .ButtonMenus(intButtonMenu).Enabled = False
                        Next
                    End With
                    mnuFileOpenVBP.Enabled = False
                    mnuFileOpenMMMP.Enabled = False
                    
                    'Start scanning.
                    Load frmScan
                End If
            End With
        End If
        'Else canceled open.
    End Sub
    4. Recompile.

    5. In the Manifest creator Project:
    Add Button name cmdRunMMMExe

    6. In the frmMain, add code:
    Code:
    Private Sub cmdRunMMMExe_Click()
        Dim strExeName As String
        
        If Not DoesFileExists(App.Path & "\mmm.exe", True) Then
            MsgBox App.Path & "\mmm.exe" & " not found", vbInformation, "File not found"
            Exit Sub
        End If
    
        If Not IsProjectSaved Then
            MsgBox "Please save the project first", vbInformation, "Information"
            Unload Me
            Exit Sub
        End If
        
        strExeName = VBInstance.ActiveVBProject.BuildFileName
        If Not DoesFileExists(strExeName, True) Then
            If MsgBox("You have no EXE file, compile project?", vbQuestion + vbYesNo, "Compile Confirm") = vbYes Then
                VBInstance.ActiveVBProject.MakeCompiledFile
                VBInstance.ActiveVBProject.SaveAs VBInstance.ActiveVBProject.Filename
            Else
                Exit Sub
            End If
        End If
        
        Dim strMMMFileName As String
        strMMMFileName = VBInstance.ActiveVBProject.Filename
    
        If DoesFileExists(strMMMFileName, True) Then
            Shell App.Path & "\mmm.exe " & strMMMFileName, vbNormalFocus
        Else
            MsgBox "The file " & strMMMFileName & " does not exist", vbInformation, "File not Exist"
        End If
        
    End Sub

  7. #7
    Addicted Member
    Join Date
    Mar 2007
    Location
    India
    Posts
    227

    Re: Calling XP/Vista/Win7 Manifest Creator from VB6 Add-Ins

    First of all Thanks for your help.

    Quote Originally Posted by Karim Wafi View Post
    5. In the Manifest creator Project:
    Add Button name cmdRunMMMExe

    6. In the frmMain, add code:[/INDENT]
    Code:
    Private Sub cmdRunMMMExe_Click()
        Dim strExeName As String
        
        If Not DoesFileExists(App.Path & "\mmm.exe", True) Then
            MsgBox App.Path & "\mmm.exe" & " not found", vbInformation, "File not found"
            Exit Sub
        End If
    
        If Not IsProjectSaved Then
            MsgBox "Please save the project first", vbInformation, "Information"
            Unload Me
            Exit Sub
        End If
        
        strExeName = VBInstance.ActiveVBProject.BuildFileName
        If Not DoesFileExists(strExeName, True) Then
            If MsgBox("You have no EXE file, compile project?", vbQuestion + vbYesNo, "Compile Confirm") = vbYes Then
                VBInstance.ActiveVBProject.MakeCompiledFile
                VBInstance.ActiveVBProject.SaveAs VBInstance.ActiveVBProject.Filename
            Else
                Exit Sub
            End If
        End If
        
        Dim strMMMFileName As String
        strMMMFileName = VBInstance.ActiveVBProject.Filename
    
        If DoesFileExists(strMMMFileName, True) Then
            Shell App.Path & "\mmm.exe " & strMMMFileName, vbNormalFocus
        Else
            MsgBox "The file " & strMMMFileName & " does not exist", vbInformation, "File not Exist"
        End If
        
    End Sub
    Have I to past code in Manifest Creator or in Manifest Creator Add-in?

    I am asking this because when I past code in Manifest Creator and try to run it I get variable not defined message for IsProjectSaved.

  8. #8

    Thread Starter
    Member
    Join Date
    Jun 2011
    Posts
    49

    Re: Calling XP/Vista/Win7 Manifest Creator from VB6 Add-Ins

    Have I to past code in Manifest Creator or in Manifest Creator Add-in?

    I am asking this because when I past code in Manifest Creator and try to run it I get variable not defined message for IsProjectSaved.
    Ok, in the attachment you can see the modified files.

    [Edit: compile both MMM.EXE and ManifestCreator.dll in the same folder]

    But .... XML file (regfree manifest) generated by MMM.EXE is not working at all. Even if I make a very simple application, that's using comctl32.ocx and comdlg32.ocx. I don't know why? and I can't fix it for now.

    And the error (cause by XML manifest) look like this:
    -
    Attached Images Attached Images  
    Attached Files Attached Files
    Last edited by Karim Wafi; Oct 6th, 2011 at 01:21 AM. Reason: forgot something (aya nu poho).

  9. #9
    Addicted Member
    Join Date
    Mar 2007
    Location
    India
    Posts
    227

    Re: Calling XP/Vista/Win7 Manifest Creator from VB6 Add-Ins

    Also I have been facing the same problem when I try to modify manifest file by hand.

  10. #10
    Hyperactive Member
    Join Date
    May 2013
    Posts
    328

    Re: Calling XP/Vista/Win7 Manifest Creator from VB6 Add-Ins

    Quote Originally Posted by Karim Wafi View Post
    This is 99% LaVolpe's code, based on this thread: http://www.vbforums.com/showthread.php?t=606736

    New feature: Auto replace StartUp Object.

    Special thank's to LaVolpe.



    -

    Its not working for dtpicker

  11. #11
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: Calling XP/Vista/Win7 Manifest Creator from VB6 Add-Ins

    Quote Originally Posted by morbid.ivan View Post
    Its not working for dtpicker
    The DTPicker from the Microsoft Windows Common Controls-2 6.0 can't be themed.

    Try CommonControls (Replacement of the MS common controls) instead.

Posting Permissions

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



Click Here to Expand Forum to Full Width