问题
In not so recent years, I have added Configuration forms to some of my VB6 programs. Tab controls are pretty handy to group different categories for the various configurations to be managed.
My Development PC is a virtual PC running Windows XP (32bit) Service Pack 3. I am programming with Visual Basic 6.0 (SP6).
It turns out that other user's PCs, not used for VB6 Programming Development and with newer versions of Windows, do not immediately understand what to do with this 'new fangled' Tab control.
tabctl32.ocx is an ActiveX control module which contains SSTab control used for Tabbed Dialog Control. Non-system processes like tabctl32.ocx originate from software you installed on your system.
vb6 "regfreecom" autocreate manifest for ocx file
Recently, I was reminded that, in years past, I had worked out a process for dealing with this:
- Create a tiny simple program with the purpose of exercising the Control in question.
- Provide the Manifest and Resource files needed.
- Compile, Build and Test the program.
- Build and use the NSIS file to create the SxS installation file for testing on any target PCs.
- With your original VB6 program, incorporate your new Manifest file and changes to its Resource file and proceed with its build and testing.
Create a tiny test simple program:
- Open VB6 [New Standard EXE]
- In the Project Properties list provide a Name: (e.g.: zTABCTL32)
- Open the Toolbox
- Project > Components > [Browse]: TABCTL32.ocx [Open] [OK]
- Click on an item just added to the bottom of the Toolbox (e.g.: SSTab)
- Add an SSTab to the Form
- In the Form Properties list provide a Name: (e.g.: frmTABCTL32)
- In the Form Properties list provide a Caption: (e.g.: TABCTL32)
- Save your form and project (maneuver to and/or create an appropriate folder)
- Set Project zTABCTL32 Properties [General] > Startup Object: [Sub Main] > [OK]
- Add to Project: main_zTABCTL32.bas - (Sub Main - frmTABCTL32.show)
- Edit main_zTABCTL32.bas Sub Main() to make sure Correct Form Name is in .Show command
- Add to Project: Module1.bas - (Declarations)
- Add to Project: ReadWritePathFile.bas (Utilities for Read/Write Path/Files)
- Add code to form (frmzTABCTL32)
- Run [Start With Full Compile]
main_zTABCTL32.bas - Sub Main - frmzTABCTL32.show ...
Attribute VB_Name = "main_zTABCTL32"
Private Type InitCommonControlsExStruct
lngSize As Long
lngICC As Long
End Type
Private Declare Function InitCommonControls Lib "comctl32" () As Long
Private Declare Function LoadLibrary Lib "kernel32.dll" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long
Private Declare Function FreeLibrary Lib "kernel32.dll" (ByVal hLibModule As Long) As Long
Private Declare Function InitCommonControlsEx Lib "comctl32.dll" (iccex As InitCommonControlsExStruct) As Boolean
Private Sub Main()
Dim iccex As InitCommonControlsExStruct, hMod As Long
Const ICC_ALL_CLASSES As Long = &HFDFF& ' combination of all known values
' constant descriptions: http://msdn.microsoft.com/en-us/library/bb775507%28VS.85%29.aspx
With iccex
.lngSize = LenB(iccex)
.lngICC = ICC_ALL_CLASSES ' you really should customize this value from the available constants
End With
On Error Resume Next ' error? Requires IEv3 or above
hMod = LoadLibrary("shell32.dll")
InitCommonControlsEx iccex
If Err Then
InitCommonControls ' try Win9x version
Err.Clear
End If
On Error GoTo 0
'... show your main form next (i.e., Form1.Show)
frmTABCTL32.Show
If hMod Then FreeLibrary hMod
'** Tip 1: Avoid using VB Frames when applying XP/Vista themes
' In place of VB Frames, use pictureboxes instead.
'** Tip 2: Avoid using Graphical Style property of buttons, checkboxes and option buttons
' Doing so will prevent them from being themed.
End Sub
'Sub Main()
' frmTABCTL32.Show
'End Sub
Module1.bas - Form Resize and Icon Manipulations
Attribute VB_Name = "Module1"
'Re:Bonnie West +vvvvvvvvvvvvvvvvvvvvv
Option Explicit
Public Const WINDOWS_ICON As Integer = 1
Public Const CHROME_ICON As Integer = 2
Public Const HALF As Single = 0.5!
Public Const ICON_JUMBO As Long = 256
Public Const ICON_BIG As Long = 1
Public Const ICON_SMALL As Long = 0
Public Const WM_SETICON As Long = &H80
Public Enum E_DrawIconEx_Flags
DI_MASK = &H1
DI_IMAGE = &H2
DI_NORMAL = &H3
DI_COMPAT = &H4
DI_DEFAULTSIZE = &H8
DI_NOMIRROR = &H10
End Enum
#If False Then
Dim DI_MASK, DI_IMAGE, DI_NORMAL, DI_COMPAT, DI_DEFAULTSIZE, DI_NOMIRROR
#End If
Public Enum E_GetWindowLong_Index
GWL_USERDATA = (-21&)
GWL_EXSTYLE = (-20&)
GWL_STYLE = (-16&)
GWL_ID = (-12&)
GWL_HWNDPARENT = (-8&)
GWL_HINSTANCE = (-6&)
GWL_WNDPROC = (-4&)
End Enum
#If False Then
Dim GWL_USERDATA, GWL_EXSTYLE, GWL_STYLE, GWL_ID, GWL_HWNDPARENT, GWL_HINSTANCE, GWL_WNDPROC
#End If
Public Enum E_LoadImage_Type
IMAGE_BITMAP = 0
IMAGE_ICON = 1
IMAGE_CURSOR = 2
End Enum
#If False Then
Dim IMAGE_BITMAP, IMAGE_ICON, IMAGE_CURSOR
#End If
Public Enum E_LoadImage_fuLoad
LR_DEFAULTCOLOR = &H0
LR_MONOCHROME = &H1
LR_LOADFROMFILE = &H10
LR_LOADTRANSPARENT = &H20
LR_DEFAULTSIZE = &H40
LR_VGACOLOR = &H80
LR_LOADMAP3DCOLORS = &H1000
LR_CREATEDIBSECTION = &H2000
LR_SHARED = &H8000&
End Enum
#If False Then
Dim LR_DEFAULTCOLOR, LR_MONOCHROME, LR_LOADFROMFILE, LR_LOADTRANSPARENT, _
LR_DEFAULTSIZE, LR_VGACOLOR, LR_LOADMAP3DCOLORS, LR_CREATEDIBSECTION, LR_SHARED
#End If
Public Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Public Declare Function AdjustWindowRectEx Lib "user32.dll" ( _
ByRef lpRect As RECT, _
ByVal dwStyle As Long, _
ByVal bMenu As Long, _
ByVal dwExStyle As Long _
) As Long
Public Declare Function DrawIconEx Lib "user32.dll" ( _
ByVal hDC As Long, _
ByVal xLeft As Long, _
ByVal yTop As Long, _
ByVal hIcon As Long, _
Optional ByVal cxWidth As Long, _
Optional ByVal cyWidth As Long, _
Optional ByVal istepIfAniCur As Long, _
Optional ByVal hbrFlickerFreeDraw As Long, _
Optional ByVal diFlags As E_DrawIconEx_Flags = DI_NORMAL _
) As Long
Public Declare Function GetWindowLongW Lib "user32.dll" ( _
ByVal hWnd As Long, _
ByVal nIndex As E_GetWindowLong_Index _
) As Long
Public Declare Function LoadImageW Lib "user32.dll" ( _
ByVal hInst As Long, _
ByVal lpszName As Long, _
Optional ByVal uType As E_LoadImage_Type = IMAGE_BITMAP, _
Optional ByVal cxDesired As Long, _
Optional ByVal cyDesired As Long, _
Optional ByVal fuLoad As E_LoadImage_fuLoad = LR_DEFAULTCOLOR _
) As Long
Public Declare Function SendMessageW Lib "user32.dll" ( _
ByVal hWnd As Long, _
ByVal uMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long _
) As Long
'Private Sub Main()
' MsgBox "Don't forget to set ""windows_perfection_logo_v2_d-bliss.ico"" as Form1's Icon!" & _
' vbNewLine & "(Set it via the Properties Window)", vbInformation
' Form1.Show
' Form2.Show
'End Sub
'Re:Bonnie West +^^^^^^^^^^^^^^^^^^^^^
ReadWritePathFile.bas (Utilities for Read/Write Path/Files)
Option Explicit
Public sOutputPath As String
'Function: AssurePathExists
'Purpose: If the complete specified path does not exist, then create it.
'Parms: sPathName - String - The full path to be assured e.g.:
' D:\DIR1\DIR2\DIR3 or D:\DIR1\DIR2\DIR3\
' If the last character is not a "\", it will be supplied.
'Returns: True if the path already exists or was successfully created, False if unsucessful.
Public Function AssurePathExists(ByVal sPathName As String) As Boolean
On Error GoTo Exit_AssurePathExists
Dim sTestPath As String, iPos As Integer
AssurePathExists = False
If IsNumeric(sPathName) Then Exit Function
If Len(sPathName) = 0 Then Exit Function
If Right$(sPathName, 1) <> "\" Then sPathName = sPathName & "\"
If PathExists(sPathName) Then
AssurePathExists = True
Exit Function
End If
iPos = 0
Do Until iPos = Len(sPathName)
iPos = InStr(iPos + 1, sPathName, "\")
sTestPath = Left$(sPathName, iPos)
If Not PathExists(sTestPath) Then MkDir sTestPath
Loop
AssurePathExists = True
Exit_AssurePathExists:
Exit Function
End Function
Function CloseFileOutput(ByVal iFileNumber As Integer) As Integer
On Error Resume Next
Close #iFileNumber
CloseFileOutput = 0
End Function
'
'Function: ExtractPath
'Purpose: extract and return the path part of a full pathname.
'Parms: FullPathName - String containing the full path name of a file.
'Returns: String containing the path part of the specified full path file name.
Function ExtractPath(ByVal FullPathName As Variant) As String
Dim i As String
'Preset the returned string to an empty string.
ExtractPath = ""
'Validate input parameter.
If (VarType(FullPathName) <> vbString) Then Exit Function
FullPathName = Trim(FullPathName)
If (Len(FullPathName) = 0) Then Exit Function
If (InStr(FullPathName, "\") = 0) Then Exit Function
'Find the last "\" in the full path name.
i = InStrRev(FullPathName, "\")
'Return the path part of the specified full path name.
ExtractPath = Left$(FullPathName, i - 1)
End Function
Function OpenFileOutput(ByVal sApp_Path_OutFile As String, Optional bAppend As Boolean = False) As Integer '04apr2011
On Error GoTo Err_OpenFileOutput
OpenFileOutput = 0
If Not PathExists(ExtractPath(sApp_Path_OutFile)) Then Exit Function '30sep2011
OpenFileOutput = FreeFile
If bAppend Then
Open sApp_Path_OutFile For Append As #OpenFileOutput
Else
Open sApp_Path_OutFile For Output As #OpenFileOutput
End If
Exit_OpenFileOutput:
Exit Function
Err_OpenFileOutput:
Select Case Err.Number
Case 70
MsgBox Err.Number & " " & Err.Description & vbCrLf & "File: " & sApp_Path_OutFile & " is already open" & vbCrLf & vbCrLf & " OR possibly ..." & vbCrLf & "Remove Redirection from command line e.g.:" & vbCrLf & "> " & sApp_Path_OutFile & vbCrLf & "Specify Output file path and name in _.INI file", , "OpenFileOutput "
OpenFileOutput = 0
Resume Exit_OpenFileOutput
Case Else
MsgBox Err.Number & " " & Err.Description, , "Error in OpenFileOutput() "
OpenFileOutput = 0
Resume Exit_OpenFileOutput
End Select
End Function
'
'Function: PathExists
'Purpose: Determine whether or not a pathname is valid.
'Parm: pathname - String containing a file name or path to be tested.
'Returns: True, if the path is valid.
' False, if path is invalid.
Function PathExists(ByVal pathname As String) As Boolean
Dim res As Variant 'RSF 6/17/98 Declared as Variant to accept a NULL value.
PathExists = False
If IsNumeric(pathname) Then Exit Function '29sep2011
'If input pathname is empty, it's not a valid path
If (Len(pathname) = 0) Then Exit Function
'Check for valid path. invalid path causes trappable runtime error
On Error GoTo patherror
res = Dir(pathname, vbDirectory)
'RSF 6/17/98 Dir can return a NULL, check for a string before proceeding.
If (VarType(res) <> vbString) Then Exit Function
'If length of the result is zero, it's not a valid path
If (Len(res) = 0) Then Exit Function
PathExists = True
Exit Function
patherror:
End Function
Public Function SetgsRWApp_Path() As String
On Error Resume Next
Dim sAppPath0 As String, sAppSubFolder As String, sProgramFiles As String, sProgramFilesx86 As String, sProgramData As String, sPUBLIC As String
SetgsRWApp_Path = ""
sAppPath0 = App.Path
sProgramFiles = Environ("ProgramFiles")
sProgramFilesx86 = Environ("ProgramFiles(x86)")
sProgramData = Environ("ProgramData")
sPUBLIC = Environ("PUBLIC")
If (Len(Trim(sPUBLIC)) > 0) Then
sPUBLIC = Left(sAppPath0, 3) & Mid(sPUBLIC, 4)
End If
If Len(Trim(sProgramFilesx86)) > 0 Then
sProgramFilesx86 = Left(sAppPath0, 3) & Mid(sProgramFilesx86, 4) '28aug2017
sAppSubFolder = Mid(sAppPath0, InStr(sAppPath0, sProgramFilesx86) + Len(sProgramFilesx86))
If (Len(Trim(sPUBLIC)) > 0) And (InStr(sAppPath0, sProgramFilesx86) > 0) Then
SetgsRWApp_Path = sPUBLIC & sAppSubFolder
ElseIf (Len(Trim(sProgramData)) > 0) And (InStr(sAppPath0, sProgramFilesx86) > 0) Then
SetgsRWApp_Path = sProgramData & sAppSubFolder
Else
MsgBox "Cannot create Read/Write Application Path" & vbCrLf & "sAppPath0='" & sAppPath0 & "'" & vbCrLf & "sProgramFiles='" & sProgramFiles & "'" & vbCrLf & "sProgramFilesx86='" & sProgramFilesx86 & "'" & vbCrLf & "sProgramData='" & sProgramData & "'" & vbCrLf & "sPUBLIC='" & sPUBLIC & "'", vbCritical, "SetgsRWApp_Path"
End If
ElseIf Len(Trim(sProgramFiles)) > 0 Then
sProgramFiles = Left(sAppPath0, 3) & Mid(sProgramFiles, 4) '28aug2017
sAppSubFolder = Mid(sAppPath0, InStr(sAppPath0, sProgramFiles) + Len(sProgramFiles))
If (Len(Trim(sPUBLIC)) > 0) And (InStr(sAppPath0, sProgramFiles) > 0) Then
SetgsRWApp_Path = sPUBLIC & sAppSubFolder
ElseIf (Len(Trim(sProgramData)) > 0) And (InStr(sAppPath0, sProgramFiles) > 0) Then
SetgsRWApp_Path = sProgramData & sAppSubFolder
Else
SetgsRWApp_Path = sAppPath0
End If
Else
MsgBox "Cannot create Read/Write Application Path" & vbCrLf & "sAppPath0='" & sAppPath0 & "'" & vbCrLf & "sProgramFiles='" & sProgramFiles & "'" & vbCrLf & "sProgramFilesx86='" & sProgramFilesx86 & "'" & vbCrLf & "sProgramData='" & sProgramData & "'" & vbCrLf & "sPUBLIC='" & sPUBLIC & "'", vbCritical, "SetgsRWApp_Path"
End If
End Function
Sub WriteFileOutput(ByVal iFileNumber As Integer, ByVal strOutput As String)
On Error GoTo Err_WriteFileOutput
If iFileNumber > 0 Then
Print #iFileNumber, strOutput
End If
Exit_WriteFileOutput:
Exit Sub
Err_WriteFileOutput:
Select Case Err.Number
Case Else
MsgBox Err.Number & " " & Err.Description, , "WriteFileOutput"
Resume Exit_WriteFileOutput
End Select
End Sub
Add code to form (frmzTABCTL32)
Option Explicit 'Don't forget to set the "windows_perfection_logo_v2_d-bliss.ico" icon as the MDIForm's Icon! (Set it via the Properties Window)
Private Const pbID As String = "picIcon"
Private Declare Function DestroyIcon Lib "user32.dll" (ByVal hIcon As Long) As Long
Private Declare Function FindWindowExW Lib "user32.dll" (Optional ByVal hWndParent As Long, Optional ByVal hWndChildAfter As Long, Optional ByVal lpszClass As Long, Optional ByVal lpszWindow As Long) As Long
Private Declare Function InvalidateRect Lib "user32.dll" (ByVal hWnd As Long, Optional ByVal lpRect As Long, Optional ByVal bErase As Long = -True) As Long
Private m_hIcon As Long
Private m_hWndMC As Long
Private m_picIcon As VB.PictureBox
Private Const lbID As String = "lblVerPathFile"
Private m_lblVPF As VB.Label
Private sCaption0 As String 'SSTab Test Code
Private Sub Form_Load()
sOutputPath = SetgsRWApp_Path() & "\Data"
AssurePathExists sOutputPath
'09jun2020 vvvvvvv
Dim strOutfile As String, iFileOutputNumber As Integer, bAppend As Boolean, strRecord As String
strOutfile = sOutputPath & "\" & Me.Name & ".txt"
bAppend = True
strRecord = Me.Name & " Form_Load() " & App.Path & " " & strOutfile
iFileOutputNumber = OpenFileOutput(strOutfile, bAppend)
WriteFileOutput iFileOutputNumber, strRecord
CloseFileOutput iFileOutputNumber
'09jun2020 ^^^^^^^
Set m_lblVPF = Controls.Add("VB.Label", lbID) '03jun2020 vvv
With m_lblVPF
.Height = 615
.Left = 240
.Top = 120
.Width = 4215
.Caption = App.EXEName & " " & App.Major & "." & Format(App.Minor, "00") & "." & Format(App.Revision, "0000") & vbCrLf & sOutputPath & "\" & vbCrLf & Me.Name & ".txt"
.Visible = True
End With '03jun2020 ^^^
sCaption0 = m_lblVPF.Caption 'SSTab Test Code
'Re:Bonnie West +vvvvvvvvvvvvvvvvvvvvv
m_hWndMC = FindWindowExW(hWnd, , StrPtr("MDIClient"))
If App.LogMode Then
Set Icon = Nothing
m_hIcon = LoadImageW(App.hInstance, WINDOWS_ICON, IMAGE_ICON, ICON_JUMBO, ICON_JUMBO)
SendMessageW hWnd, WM_SETICON, ICON_BIG, LoadImageW(App.hInstance, WINDOWS_ICON, IMAGE_ICON, , , LR_DEFAULTSIZE)
SendMessageW hWnd, WM_SETICON, ICON_SMALL, LoadImageW(App.hInstance, WINDOWS_ICON, IMAGE_ICON, 16&, 16&)
End If
Set m_picIcon = Controls.Add("VB.PictureBox", pbID)
With m_picIcon
.AutoRedraw = True
.BackColor = BackColor
.BorderStyle = 0
.ClipControls = False
.ScaleMode = vbPixels
End With
'Re:Bonnie West +^^^^^^^^^^^^^^^^^^^^^
End Sub
Private Sub Form_Resize()
'Re:Bonnie West +vvvvvvvvvvvvvvvvvvvvv
If WindowState <> vbMinimized Then
With m_picIcon
.Cls
.Move 0!, 0!, ScaleWidth, ScaleHeight
If m_hIcon Then
DrawIconEx .hDC, (.ScaleWidth - ICON_JUMBO) * HALF, _
(.ScaleHeight - ICON_JUMBO) * HALF, m_hIcon, ICON_JUMBO, ICON_JUMBO
ElseIf Not Icon Is Nothing Then
.PaintPicture Icon, (.ScaleWidth - .ScaleX(Icon.Width, vbHimetric, vbPixels)) * HALF, _
(.ScaleHeight - .ScaleY(Icon.Height, vbHimetric, vbPixels)) * HALF
End If
Set Picture = .Image
InvalidateRect m_hWndMC
End With
End If
'Re:Bonnie West +^^^^^^^^^^^^^^^^^^^^^
End Sub
Private Sub Form_Unload(Cancel As Integer)
Dim strOutfile As String, iFileOutputNumber As Integer, bAppend As Boolean, strRecord As String
strOutfile = sOutputPath & "\" & Me.Name & ".txt"
bAppend = True
'08jun2020 strRecord = Me.Name & vbCrLf & App.EXEName & " " & App.Major & "." & Format(App.Minor, "00") & "." & Format(App.Revision, "0000") & vbCrLf & App.Path
strRecord = Me.Name & " " & Format(Now, "yyyy mmm dd hh:nn am/pm") & vbCrLf & App.EXEName & " " & App.Major & "." & Format(App.Minor, "00") & "." & Format(App.Revision, "0000") & vbCrLf & App.Path '08jun2020
iFileOutputNumber = OpenFileOutput(strOutfile, bAppend)
WriteFileOutput iFileOutputNumber, strRecord
CloseFileOutput iFileOutputNumber
Set m_lblVPF = Nothing
Controls.Remove lbID
'Re:Bonnie West +vvvvvvvvvvvvvvvvvvvvv
Set m_picIcon = Nothing
Controls.Remove pbID
If m_hIcon Then
DestroyIcon m_hIcon
DestroyIcon SendMessageW(hWnd, WM_SETICON, ICON_BIG, 0&)
DestroyIcon SendMessageW(hWnd, WM_SETICON, ICON_SMALL, 0&)
End If
'Re:Bonnie West +^^^^^^^^^^^^^^^^^^^^^
End Sub
Private Sub SSTab1_Click(PreviousTab As Integer)
m_lblVPF.Caption = sCaption0 & " [ " & PreviousTab & " ] " 'SSTab Test Code
End Sub
- Provide the Manifest and Resource files needed.
Shut Down VB6 zTABCTL32 Project or remove zTABCTL32.RES from Project
UMMM.ini
This .ini file, following the Identity line, contains a list of dependency files. They are listed in the .vbp file (e.g.:
Object={BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0; TABCTL32.OCX
).You can also find them itemized within VB6 Menu > Project > Components ...
On that Components form, you can choose
[x] Selected Items Only
to more easily view the list.Highlighting each Component in the list will display, below:
(e.g.: Location C:\ ... \TABCTL32.OCX )
In the .ini file, I specify the path to the dependency file because it is not stored in the local Project folder.
Identity zTABCTL32.exe zTABCTL32.exe "TABCTL32 Test program 1.0"
File C:\WINDOWS\system32\TABCTL32.ocx
UMMM.bat
UMMM.exe zUMMMTabCtl32.ini .\manifest\zTABCTL32.exe.manifest
pause done?
Is there a way to specify File Name= in UMMM (Unattended Make My Manifest) creation of Program.exe.manifest?
I edited the resulting zTABCTL32.exe.manifest
with Notepad and changed:
From: <file name="..\..\..\..\WINDOWS\system32\TABCTL32.ocx">
To: <file name="Dependencies\TABCTL32.ocx">
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<assemblyIdentity name="zTABCTL32.exe" processorArchitecture="X86" type="win32" version="1.0.0.20" />
<description>TABCTL32 Test program 1.0</description>
<file name="Dependencies\TABCTL32.ocx">
<typelib tlbid="{BDC217C8-ED16-11CD-956C-0000C04E4C0A}" version="1.1" flags="control,hasdiskimage" helpdir="" />
<comClass clsid="{BDC217C5-ED16-11CD-956C-0000C04E4C0A}" tlbid="{BDC217C8-ED16-11CD-956C-0000C04E4C0A}" progid="TabDlg.SSTab.1" threadingModel="Apartment" miscStatus="" miscStatusContent="recomposeonresize,cantlinkinside,insideout,activatewhenvisible,simpleframe,setclientsitefirst">
<progid>TabDlg.SSTab</progid>
</comClass>
<comClass clsid="{942085FD-8AEE-465F-ADD7-5E7AA28F8C14}" tlbid="{BDC217C8-ED16-11CD-956C-0000C04E4C0A}" threadingModel="Apartment" miscStatus="" miscStatusContent="recomposeonresize,cantlinkinside,insideout,activatewhenvisible,simpleframe,setclientsitefirst" />
</file>
</assembly>
MT.bat - this did not work out for me?
My reference is: https://docs.microsoft.com/en-us/windows/win32/sbscs/mt-exe
mt -nologo -manifest .\manifest\zTABCTL32.exe.manifest -outputresource:"zTABCTL32.RES;1"
pause Done?
The Resource file was not created? I have no idea what the [#] Resource_ID (1) is?
C:\Devlpmnt\LANG\VB6\zTABCTL32>mt -nologo -manifest .\manifest\zTABCTL32.exe.ma
nifest -outputresource:"zTABCTL32.RES;1"
mt : general error c101008d: Failed to write the updated manifest to the resourc
e of file "zTABCTL32.RES". The system cannot find the file specified.
C:\Devlpmnt\LANG\VB6\zTABCTL32>pause Done?
Press any key to continue . . .
Instead I used ManifestCreatorv2.0.3
- The Manifest > Create from Project File (vbp) zzTABCTL32.vbp
- The Manifest > Append/Merge Manifest - From file [e.g.: .\manifest\zTABCTL32.exe.manifest]
- The Manifest > Export Manifest >
[_] Indent Manifest
[_] Do Not Use Prefixed Name Spaces
[x] Do Not Export Empty/Blank Attributes
Destination Resource File - save to zzTABCTL32.RES (Replace)
- Open VB6 zTABCTL32 Project or Add zTABCTL32.RES back into Project
Compile, Build and Test the program.
- Within VB6 zTABCTL32 Project, start witn full compile: Runs OK
- Within VB6 zTABCTL32 Project, File -> Make new executable:
- Save Project
Running zTABCTL32.exe from with in its Project folder
[Run-Error 7 out of memory?]
- Build and use the NSIS file to create the SxS installation file for testing on any target PCs.
I adjusted the NSIS file to install only the dependency files listed in the .vbp file, the UMMM.ini file and in the resulting .exe.manifest file.
Installed on WinXP(32) works OK
Installed on Win7(64) works OK
Installed on Win10(64) works OK
- With your original VB6 program, incorporate your new Manifest file and changes to its Resource file and proceed with its build and testing.
回答1:
I'm using UMMM to generate a simple manifest for the SSTab control and it works
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<assemblyIdentity name="MyCompany.Project1" processorArchitecture="X86" type="win32" version="1.0.0.0" />
<description>MyCompany Project1 1.0</description>
<file name="TABCTL32.ocx">
<typelib tlbid="{BDC217C8-ED16-11CD-956C-0000C04E4C0A}" version="1.1" flags="control,hasdiskimage" helpdir="" />
<comClass clsid="{BDC217C5-ED16-11CD-956C-0000C04E4C0A}" tlbid="{BDC217C8-ED16-11CD-956C-0000C04E4C0A}" progid="TabDlg.SSTab.1" threadingModel="Apartment" miscStatus="" miscStatusContent="recomposeonresize,cantlinkinside,insideout,activatewhenvisible,simpleframe,setclientsitefirst">
<progid>TabDlg.SSTab</progid>
</comClass>
</file>
</assembly>
Check out the complete test project here. The build.bat
in scripts
shells Ummm.exe
to generate Project1.ini.manifest
and then uses mt.exe
to embed this manifest in Project1.exe
executable.
This batch file execution can be skipped altogether if the manifest is one-time compiled to a RES
file and this Project1.res
file is added to the VB6 project.
回答2:
I have taken 2 of my programs through these steps, using UMMM.exe
and ManifestCreatorv2.0.3
and VB6
and an updated NSIS file
to succesfully operate on all 3 systems:
Installed on WinXP(32) works OK
Installed on Win7(64) works OK
Installed on Win10(64) works OK
There are still some things I do not understand about UMMM.exe and MT.exe.
Additional understanding may help with a better answer.
Another conclusion from this experience is that there is NO need to create manifest files for individual dependency files.
If anyone is really curious, the 2 freeware programs I have fixed are Gastro and QueryMgr at https://www.indra.com/~anderci/ciaartcl.htm
来源:https://stackoverflow.com/questions/62184019/vb6-regfreecom-sidebyside-sxs-manifest-test-for-tabctl32-ocx