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.
-
Printable View
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.
-
If you give this thing a more complete description of what it does, I'll link to it from my project
Before use it, compile and name the component with ManifestCreator.dll
Click install.bat for registering the addins file.
How to use:
- In your VB6 Application click Add-Ins menu >> click Manifest Creator menu.
- Adjust any settings in the Manifest Creator.
- Click Create Manifest button. Finish.
Note:
When you click the Create Manifest button. This Add-Ins application will automatic:
- Adding modManifestResource.bas file.
- Adding XP.manifest.res file.
- 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:
- Sub Main() procedure?,
- Resource file do not already have manifest?,
- Resource file already have embedded manifest?
1. Sub Main() procedure will change to Sub OldSubMain() and the code in modManifestResource.bas look like:
2. The Add-Ins will add manifest and merger it with the existing resource.Code:' Code
On Error GoTo 0
'... show your main form next (i.e., Form1.Show)
OldSubMain
If hMod Then FreeLibrary hMod
' Code
3. The old manifest will be replaced with the new manifest
Thank's LaVolpe for the very handy tools. :thumb:
thanks for share this addin....
1 rate 4 you bro......... :D
It is possible to add facility for RegFree way of registering ActiveX DLLs in by this Manifest Creator?
thanks for share this addin....
1 rate 4 you bro.........
You are welcome, Mas Bro. :)
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
Ok, in the attachment you can see the modified files.Quote:
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.
[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:
-
Also I have been facing the same problem when I try to modify manifest file by hand.
The DTPicker from the Microsoft Windows Common Controls-2 6.0 can't be themed.
Try CommonControls (Replacement of the MS common controls) instead.