home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / Visualicio47132182002.psc / Form1.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2002-01-06  |  24.1 KB  |  637 lines

  1. VERSION 5.00
  2. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
  3. Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
  4. Begin VB.Form Form1 
  5.    BorderStyle     =   3  'Fixed Dialog
  6.    Caption         =   "Visualicious - Visual Styles Wizard"
  7.    ClientHeight    =   5310
  8.    ClientLeft      =   45
  9.    ClientTop       =   735
  10.    ClientWidth     =   5745
  11.    Icon            =   "Form1.frx":0000
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   5310
  16.    ScaleWidth      =   5745
  17.    StartUpPosition =   2  'CenterScreen
  18.    Begin VB.PictureBox Picture2 
  19.       Appearance      =   0  'Flat
  20.       BackColor       =   &H80000005&
  21.       BorderStyle     =   0  'None
  22.       ForeColor       =   &H80000008&
  23.       Height          =   4650
  24.       Left            =   5880
  25.       ScaleHeight     =   4650
  26.       ScaleWidth      =   5355
  27.       TabIndex        =   6
  28.       Top             =   480
  29.       Visible         =   0   'False
  30.       Width           =   5360
  31.       Begin VB.CommandButton cmdRemove 
  32.          Caption         =   "Remove From List"
  33.          BeginProperty Font 
  34.             Name            =   "Tahoma"
  35.             Size            =   8.25
  36.             Charset         =   0
  37.             Weight          =   400
  38.             Underline       =   0   'False
  39.             Italic          =   0   'False
  40.             Strikethrough   =   0   'False
  41.          EndProperty
  42.          Height          =   450
  43.          Left            =   120
  44.          TabIndex        =   9
  45.          Top             =   3960
  46.          Width           =   1935
  47.       End
  48.       Begin ComctlLib.ListView ListView1 
  49.          Height          =   3375
  50.          Left            =   120
  51.          TabIndex        =   7
  52.          Top             =   480
  53.          Width           =   5055
  54.          _ExtentX        =   8916
  55.          _ExtentY        =   5953
  56.          View            =   3
  57.          LabelWrap       =   -1  'True
  58.          HideSelection   =   -1  'True
  59.          _Version        =   327682
  60.          ForeColor       =   -2147483640
  61.          BackColor       =   -2147483643
  62.          Appearance      =   1
  63.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  64.             Name            =   "Tahoma"
  65.             Size            =   8.25
  66.             Charset         =   0
  67.             Weight          =   400
  68.             Underline       =   0   'False
  69.             Italic          =   0   'False
  70.             Strikethrough   =   0   'False
  71.          EndProperty
  72.          NumItems        =   3
  73.          BeginProperty ColumnHeader(1) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
  74.             Key             =   ""
  75.             Object.Tag             =   ""
  76.             Text            =   "Application's Name"
  77.             Object.Width           =   3528
  78.          EndProperty
  79.          BeginProperty ColumnHeader(2) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
  80.             SubItemIndex    =   1
  81.             Key             =   ""
  82.             Object.Tag             =   ""
  83.             Text            =   "Application Path"
  84.             Object.Width           =   8819
  85.          EndProperty
  86.          BeginProperty ColumnHeader(3) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
  87.             SubItemIndex    =   2
  88.             Key             =   ""
  89.             Object.Tag             =   ""
  90.             Text            =   ""
  91.             Object.Width           =   2540
  92.          EndProperty
  93.       End
  94.       Begin VB.CommandButton cmdRestore 
  95.          Caption         =   "Restore Application"
  96.          BeginProperty Font 
  97.             Name            =   "Tahoma"
  98.             Size            =   8.25
  99.             Charset         =   0
  100.             Weight          =   400
  101.             Underline       =   0   'False
  102.             Italic          =   0   'False
  103.             Strikethrough   =   0   'False
  104.          EndProperty
  105.          Height          =   450
  106.          Left            =   3240
  107.          TabIndex        =   8
  108.          Top             =   3960
  109.          Width           =   1935
  110.       End
  111.       Begin VB.Label Label9 
  112.          AutoSize        =   -1  'True
  113.          BackStyle       =   0  'Transparent
  114.          Caption         =   "Recovery List:"
  115.          BeginProperty Font 
  116.             Name            =   "Tahoma"
  117.             Size            =   9.75
  118.             Charset         =   0
  119.             Weight          =   400
  120.             Underline       =   0   'False
  121.             Italic          =   0   'False
  122.             Strikethrough   =   0   'False
  123.          EndProperty
  124.          Height          =   240
  125.          Left            =   120
  126.          TabIndex        =   23
  127.          Top             =   120
  128.          Width           =   1200
  129.       End
  130.    End
  131.    Begin VB.TextBox tbx2 
  132.       Height          =   2895
  133.       Left            =   2160
  134.       MultiLine       =   -1  'True
  135.       TabIndex        =   5
  136.       Text            =   "Form1.frx":1CFA
  137.       Top             =   8040
  138.       Width           =   5775
  139.    End
  140.    Begin VB.PictureBox Picture1 
  141.       Appearance      =   0  'Flat
  142.       BackColor       =   &H80000005&
  143.       BorderStyle     =   0  'None
  144.       ForeColor       =   &H80000008&
  145.       Height          =   4650
  146.       Left            =   240
  147.       ScaleHeight     =   4650
  148.       ScaleWidth      =   5355
  149.       TabIndex        =   2
  150.       Top             =   480
  151.       Width           =   5360
  152.       Begin VB.CommandButton cmdBrowse 
  153.          Caption         =   "Browse For Application"
  154.          BeginProperty Font 
  155.             Name            =   "Tahoma"
  156.             Size            =   8.25
  157.             Charset         =   0
  158.             Weight          =   400
  159.             Underline       =   0   'False
  160.             Italic          =   0   'False
  161.             Strikethrough   =   0   'False
  162.          EndProperty
  163.          Height          =   450
  164.          Left            =   120
  165.          TabIndex        =   4
  166.          Top             =   3960
  167.          Width           =   1935
  168.       End
  169.       Begin VB.CommandButton cmdUpdate 
  170.          Caption         =   "Update Application"
  171.          Enabled         =   0   'False
  172.          BeginProperty Font 
  173.             Name            =   "Tahoma"
  174.             Size            =   8.25
  175.             Charset         =   0
  176.             Weight          =   400
  177.             Underline       =   0   'False
  178.             Italic          =   0   'False
  179.             Strikethrough   =   0   'False
  180.          EndProperty
  181.          Height          =   450
  182.          Left            =   3240
  183.          TabIndex        =   3
  184.          Top             =   3960
  185.          UseMaskColor    =   -1  'True
  186.          Width           =   1935
  187.       End
  188.       Begin VB.Label tbxPath 
  189.          BackStyle       =   0  'Transparent
  190.          Height          =   195
  191.          Left            =   1320
  192.          TabIndex        =   22
  193.          Top             =   1440
  194.          Width           =   3975
  195.       End
  196.       Begin VB.Label Label8 
  197.          AutoSize        =   -1  'True
  198.          BackStyle       =   0  'Transparent
  199.          Caption         =   "File Path:"
  200.          ForeColor       =   &H8000000D&
  201.          Height          =   195
  202.          Left            =   120
  203.          TabIndex        =   21
  204.          Top             =   1440
  205.          Width           =   660
  206.       End
  207.       Begin VB.Label lblADescription 
  208.          BackStyle       =   0  'Transparent
  209.          Height          =   195
  210.          Left            =   1320
  211.          TabIndex        =   20
  212.          Top             =   960
  213.          Width           =   3255
  214.       End
  215.       Begin VB.Label lblACompany 
  216.          BackStyle       =   0  'Transparent
  217.          Height          =   195
  218.          Left            =   1320
  219.          TabIndex        =   19
  220.          Top             =   720
  221.          Width           =   3255
  222.       End
  223.       Begin VB.Label lblAProdName 
  224.          BackStyle       =   0  'Transparent
  225.          Height          =   195
  226.          Left            =   1320
  227.          TabIndex        =   18
  228.          Top             =   480
  229.          Width           =   3255
  230.       End
  231.       Begin VB.Label Label3 
  232.          AutoSize        =   -1  'True
  233.          BackStyle       =   0  'Transparent
  234.          Caption         =   "Description:"
  235.          ForeColor       =   &H8000000D&
  236.          Height          =   195
  237.          Left            =   120
  238.          TabIndex        =   17
  239.          Top             =   960
  240.          Width           =   855
  241.       End
  242.       Begin VB.Label Label2 
  243.          AutoSize        =   -1  'True
  244.          BackStyle       =   0  'Transparent
  245.          Caption         =   "Company:"
  246.          ForeColor       =   &H8000000D&
  247.          Height          =   195
  248.          Left            =   120
  249.          TabIndex        =   16
  250.          Top             =   720
  251.          Width           =   735
  252.       End
  253.       Begin VB.Label Label1 
  254.          AutoSize        =   -1  'True
  255.          BackStyle       =   0  'Transparent
  256.          Caption         =   "Product Name:"
  257.          ForeColor       =   &H8000000D&
  258.          Height          =   195
  259.          Left            =   120
  260.          TabIndex        =   15
  261.          Top             =   480
  262.          Width           =   1065
  263.       End
  264.       Begin VB.Label Label4 
  265.          AutoSize        =   -1  'True
  266.          BackStyle       =   0  'Transparent
  267.          Caption         =   "File Name:"
  268.          ForeColor       =   &H8000000D&
  269.          Height          =   195
  270.          Left            =   120
  271.          TabIndex        =   14
  272.          Top             =   1200
  273.          Width           =   750
  274.       End
  275.       Begin VB.Label lblAFileName 
  276.          BackStyle       =   0  'Transparent
  277.          Height          =   195
  278.          Left            =   1320
  279.          TabIndex        =   13
  280.          Top             =   1200
  281.          Width           =   3255
  282.       End
  283.       Begin VB.Label Label7 
  284.          AutoSize        =   -1  'True
  285.          BackStyle       =   0  'Transparent
  286.          Caption         =   "Application Information:"
  287.          BeginProperty Font 
  288.             Name            =   "Tahoma"
  289.             Size            =   9.75
  290.             Charset         =   0
  291.             Weight          =   400
  292.             Underline       =   0   'False
  293.             Italic          =   0   'False
  294.             Strikethrough   =   0   'False
  295.          EndProperty
  296.          Height          =   240
  297.          Left            =   120
  298.          TabIndex        =   12
  299.          Top             =   120
  300.          Width           =   2055
  301.       End
  302.       Begin VB.Label Label6 
  303.          Alignment       =   2  'Center
  304.          BackStyle       =   0  'Transparent
  305.          Caption         =   $"Form1.frx":1EA6
  306.          BeginProperty Font 
  307.             Name            =   "Tahoma"
  308.             Size            =   8.25
  309.             Charset         =   0
  310.             Weight          =   400
  311.             Underline       =   0   'False
  312.             Italic          =   0   'False
  313.             Strikethrough   =   0   'False
  314.          EndProperty
  315.          ForeColor       =   &H8000000D&
  316.          Height          =   1035
  317.          Left            =   240
  318.          TabIndex        =   11
  319.          Top             =   2400
  320.          Width           =   4725
  321.       End
  322.       Begin VB.Label Label5 
  323.          AutoSize        =   -1  'True
  324.          BackStyle       =   0  'Transparent
  325.          Caption         =   "Notice!"
  326.          BeginProperty Font 
  327.             Name            =   "Tahoma"
  328.             Size            =   9.75
  329.             Charset         =   0
  330.             Weight          =   400
  331.             Underline       =   0   'False
  332.             Italic          =   0   'False
  333.             Strikethrough   =   0   'False
  334.          EndProperty
  335.          Height          =   240
  336.          Left            =   120
  337.          TabIndex        =   10
  338.          Top             =   2160
  339.          Width           =   585
  340.       End
  341.    End
  342.    Begin MSComDlg.CommonDialog CommonDialog1 
  343.       Left            =   9600
  344.       Top             =   8040
  345.       _ExtentX        =   847
  346.       _ExtentY        =   847
  347.       _Version        =   393216
  348.    End
  349.    Begin VB.TextBox tbx1 
  350.       Height          =   1605
  351.       Left            =   2160
  352.       MultiLine       =   -1  'True
  353.       TabIndex        =   0
  354.       Text            =   "Form1.frx":1FEE
  355.       Top             =   7560
  356.       Width           =   6015
  357.    End
  358.    Begin ComctlLib.TabStrip TabStrip1 
  359.       Height          =   5055
  360.       Left            =   120
  361.       TabIndex        =   1
  362.       Top             =   120
  363.       Width           =   5535
  364.       _ExtentX        =   9763
  365.       _ExtentY        =   8916
  366.       TabWidthStyle   =   2
  367.       TabFixedWidth   =   3351
  368.       _Version        =   327682
  369.       BeginProperty Tabs {0713E432-850A-101B-AFC0-4210102A8DA7} 
  370.          NumTabs         =   2
  371.          BeginProperty Tab1 {0713F341-850A-101B-AFC0-4210102A8DA7} 
  372.             Caption         =   "Update Application"
  373.             Key             =   ""
  374.             Object.Tag             =   ""
  375.             ImageVarType    =   2
  376.          EndProperty
  377.          BeginProperty Tab2 {0713F341-850A-101B-AFC0-4210102A8DA7} 
  378.             Caption         =   "Application Recovery"
  379.             Key             =   ""
  380.             Object.Tag             =   ""
  381.             ImageVarType    =   2
  382.          EndProperty
  383.       EndProperty
  384.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  385.          Name            =   "Tahoma"
  386.          Size            =   8.25
  387.          Charset         =   0
  388.          Weight          =   400
  389.          Underline       =   0   'False
  390.          Italic          =   0   'False
  391.          Strikethrough   =   0   'False
  392.       EndProperty
  393.    End
  394.    Begin VB.Menu mnuFile 
  395.       Caption         =   "File"
  396.       Begin VB.Menu mnuBA 
  397.          Caption         =   "Browse For Application"
  398.       End
  399.       Begin VB.Menu mnuUA 
  400.          Caption         =   "Update Application"
  401.          Enabled         =   0   'False
  402.       End
  403.       Begin VB.Menu sep 
  404.          Caption         =   "-"
  405.       End
  406.       Begin VB.Menu mnuExit 
  407.          Caption         =   "Exit"
  408.       End
  409.    End
  410.    Begin VB.Menu MnuSettings 
  411.       Caption         =   "Options"
  412.       Begin VB.Menu mnuRA 
  413.          Caption         =   "Always Run Application After Updating"
  414.       End
  415.    End
  416.    Begin VB.Menu mnuHelp 
  417.       Caption         =   "Help"
  418.       Enabled         =   0   'False
  419.       Visible         =   0   'False
  420.       Begin VB.Menu mnuReadme 
  421.          Caption         =   "ReadMe.txt"
  422.       End
  423.       Begin VB.Menu mnuAbout 
  424.          Caption         =   "About"
  425.       End
  426.    End
  427. Attribute VB_Name = "Form1"
  428. Attribute VB_GlobalNameSpace = False
  429. Attribute VB_Creatable = False
  430. Attribute VB_PredeclaredId = True
  431. Attribute VB_Exposed = False
  432. Private FSO As New FileSystemObject
  433. Private Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long
  434. Private Declare Function BeginUpdateResource Lib "kernel32" Alias "BeginUpdateResourceA" _
  435.         (ByVal pFileName As String, _
  436.         ByVal bDeleteExistingResources As Long) As Long
  437. Private Declare Function UpdateResource Lib "kernel32" Alias "UpdateResourceA" _
  438.         (ByVal hUpdate As Long, _
  439.         ByVal lpType As Integer, _
  440.         ByVal lpName As Integer, _
  441.         ByVal wLanguage As Long, _
  442.         lpData As Any, _
  443.         ByVal cbData As Long) As Long
  444. Private Declare Function EndUpdateResource Lib "kernel32" Alias "EndUpdateResourceA" _
  445.         (ByVal hUpdate As Long, _
  446.         ByVal fDiscard As Long) As Long
  447. Private Declare Function GetClassLong Lib "user32" Alias "GetClassLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
  448. Private Declare Function SetClassLong Lib "user32" Alias "SetClassLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
  449. Private Const CS_DROPSHADOW = &H20000
  450. Private Const GCL_STYLE = (-26)
  451. Private Declare Function InitCommonControls Lib "COMCTL32" () As Long
  452. Private sManifest As String, strFile As String
  453. Private Sub cmdBrowse_Click()
  454.     With CommonDialog1
  455.     .DialogTitle = "Portable Executable"
  456.     .CancelError = False
  457.     .FileName = ""
  458.     .Filter = "Portable Executible|*.exe"
  459.     .MaxFileSize = 32000
  460.     .ShowOpen
  461.     End With
  462.     If CommonDialog1.FileName = "" Then Exit Sub
  463.     lblAFileName.Caption = CommonDialog1.FileTitle
  464.     tbxPath.Caption = CommonDialog1.FileName
  465.     If lblAFileName.Caption = "" Then
  466.     cmdUpdate.Enabled = False
  467.     mnuUA.Enabled = False
  468.     Else
  469.     cmdUpdate.Enabled = True
  470.     mnuUA.Enabled = True
  471.     End If
  472.     'load application's company name
  473.     lblACompany = GetCompanyName(CommonDialog1.FileName)
  474.     'load application's description
  475.     lblADescription = GetFileDescription(CommonDialog1.FileName)
  476.     'load application's product name
  477.     lblAProdName = GetProductName(CommonDialog1.FileName)
  478. End Sub
  479. Private Sub cmdUpdate_Click()
  480. strFile = tbxPath.Caption
  481. CreateManifest
  482. ApplyManifest sManifest, Len(sManifest)
  483. 'save to manifest settings
  484. SaveRegString HKEY_LOCAL_MACHINE, "Software\OSI\Visualicious\Recovery\" & lblAFileName.Caption, "FileName", lblAFileName.Caption
  485. SaveRegString HKEY_LOCAL_MACHINE, "Software\OSI\Visualicious\Recovery\" & lblAFileName.Caption, "FilePath", tbxPath.Caption
  486. 'save to win reg
  487. SaveRegString HKEY_CURRENT_USER, "Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers", tbxPath.Caption, "WIN2000"
  488. With ListView1.ListItems.Add(, , lblAProdName)
  489.     .SubItems(1) = tbxPath.Caption
  490. End With
  491.  If mnuRA.Checked = True Then Shell tbxPath.Caption, vbNormalFocus
  492. lblACompany = ""
  493. lblADescription = ""
  494. lblAProdName = ""
  495. lblAFileName.Caption = ""
  496. tbxPath.Caption = ""
  497. cmdUpdate.Enabled = False
  498. cmdRestore.Enabled = True
  499. End Sub
  500. Private Sub tbxDescription_Change()
  501.  cmdUpdate.Enabled = True
  502. End Sub
  503. Private Sub cmdRestore_Click()
  504. On Error Resume Next
  505. If ListView1.SelectedItem.Selected = False Then
  506. MsgBox "Please Select Application To Restore"
  507. Exit Sub
  508. End If
  509. 'Delete  from registry
  510. DeleteKey HKEY_LOCAL_MACHINE, "Software\OSI\Visualicious\Recovery\" & ListView1.SelectedItem.Text & ".exe"
  511. DeleteValue HKEY_CURRENT_USER, "Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers", ListView1.SelectedItem.SubItems(1)
  512. 'delete file
  513. FSO.DeleteFile (ListView1.SelectedItem.SubItems(1))
  514. FSO.CopyFile ListView1.SelectedItem.SubItems(1) & ".original", ListView1.SelectedItem.SubItems(1)
  515. Pause (2)
  516. FSO.DeleteFile (ListView1.SelectedItem.SubItems(1) & ".original")
  517. 'Delete from listview
  518. ListView1.ListItems.Remove (ListView1.SelectedItem.Index)
  519. If ListView1.ListItems.Count = 0 Then cmdRestore.Enabled = False
  520. MsgBox "Application Restored"
  521. End Sub
  522. Private Sub cmdRemove_Click()
  523. 'On Error Resume Next
  524. If ListView1.SelectedItem.Selected = False Then
  525. MsgBox "Please Select Application To Restore"
  526. Exit Sub
  527. End If
  528. 'Delete  from registry
  529. DeleteKey HKEY_LOCAL_MACHINE, "Software\OSI\Visualicious\Recovery\" & ListView1.SelectedItem.Text & ".exe"
  530. DeleteValue HKEY_CURRENT_USER, "Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers", ListView1.SelectedItem.SubItems(1)
  531. 'Delete from listview
  532. ListView1.ListItems.Remove (ListView1.SelectedItem.Index)
  533. If ListView1.ListItems.Count = 0 Then cmdRestore.Enabled = False
  534. End Sub
  535. Private Sub Form_Initialize()
  536. Call InitCommonControls
  537. End Sub
  538. Private Sub Form_Load()
  539. On Error Resume Next
  540. Dim rApp As String, fName As String, fPath As String, prodname As String, resi As Long
  541. SetClassLong Me.hWnd, GCL_STYLE, GetClassLong(Me.hWnd, GCL_STYLE) Or CS_DROPSHADOW
  542. Picture1.Left = 240
  543. Picture2.Left = 240
  544. resi = GetRegLong(HKEY_LOCAL_MACHINE, "Software\OSI\Visualicious", "AutoRun")
  545. If resi = 1 Then mnuRA.Checked = True
  546. 'load saved info to listview
  547. countit = CountRegKeys(HKEY_LOCAL_MACHINE, "Software\OSI\Visualicious\Recovery")
  548. For i = 0 To countit - 1
  549. fApp = GetRegKey(HKEY_LOCAL_MACHINE, "Software\OSI\Visualicious\Recovery", i)
  550. fName = GetRegString(HKEY_LOCAL_MACHINE, "Software\OSI\Visualicious\Recovery\" & fApp, "FileName")
  551. fPath = GetRegString(HKEY_LOCAL_MACHINE, "Software\OSI\Visualicious\Recovery\" & fApp, "FilePath")
  552. prodname = GetProductName(GetRegString(HKEY_LOCAL_MACHINE, "Software\OSI\Visualicious\Recovery\" & fApp, "FilePath"))
  553.     With ListView1.ListItems.Add(, , prodname)
  554.         .SubItems(1) = fPath
  555.     End With
  556. Next i
  557. If ListView1.ListItems.Count = 0 Then cmdRestore.Enabled = False
  558. End Sub
  559. Private Sub mnuAbout_Click()
  560. frmAbout.Show
  561. End Sub
  562. Private Sub mnuBA_Click()
  563. cmdBrowse_Click
  564. End Sub
  565. Private Sub mnuExit_Click()
  566. Unload Me
  567. End Sub
  568. Private Sub mnuRA_Click()
  569. If mnuRA.Checked = False Then
  570. mnuRA.Checked = True
  571. SaveRegLong HKEY_LOCAL_MACHINE, "Software\OSI\Visualicious", "AutoRun", 1
  572. mnuRA.Checked = False
  573. SaveRegLong HKEY_LOCAL_MACHINE, "Software\OSI\Visualicious", "AutoRun", 0
  574. End If
  575. End Sub
  576. Private Sub mnuUA_Click()
  577. If cmdUpdate.Enabled = True Then cmdUpdate_Click
  578. End Sub
  579. Private Sub TabStrip1_Click()
  580. Select Case TabStrip1.SelectedItem.Index
  581. Case 1
  582. Picture1.Visible = True
  583. Picture2.Visible = False
  584. Case 2
  585. Picture2.Visible = True
  586. Picture1.Visible = False
  587. End Select
  588. End Sub
  589. Public Function CreateManifest()
  590.         sManifest = "<?xml version=" & Chr(34) & "1.0" & Chr(34) & " encoding=" & Chr(34) & "UTF-8" & Chr(34) & " standalone=" & Chr(34) & "yes" & Chr(34) & "?>"
  591.         sManifest = sManifest & Chr(13) & "<assembly xmlns=" & Chr(34) & "urn:schemas-microsoft-com:asm.v1" & Chr(34) & " manifestVersion=" & Chr(34) & "1.0" & Chr(34) & ">"
  592.         sManifest = sManifest & Chr(13) & "<assemblyIdentity"
  593.         sManifest = sManifest & Chr(13) & "  name=" & Chr(34) & lblAProdName & Chr(34)
  594.         sManifest = sManifest & Chr(13) & "  processorArchitecture=" & Chr(34) & "x86" & Chr(34)
  595.         sManifest = sManifest & Chr(13) & "  version=" & Chr(34) & "1.0.0.0" & Chr(34)
  596.         sManifest = sManifest & Chr(13) & "  type=" & Chr(34) & "win32" & Chr(34) & "/>"
  597.         sManifest = sManifest & Chr(13) & "<description>" & Me.lblADescription & "</description>"
  598.         sManifest = sManifest & Chr(13) & "<dependency>"
  599.         sManifest = sManifest & Chr(13) & "  <dependentAssembly>"
  600.         sManifest = sManifest & Chr(13) & "    <assemblyIdentity"
  601.         sManifest = sManifest & Chr(13) & "      type=" & Chr(34) & "win32" & Chr(34)
  602.         sManifest = sManifest & Chr(13) & "      name=" & Chr(34) & "Microsoft.Windows.Common-Controls" & Chr(34)
  603.         sManifest = sManifest & Chr(13) & "      version=" & Chr(34) & "6.0.0.0" & Chr(34)
  604.         sManifest = sManifest & Chr(13) & "      processorArchitecture=" & Chr(34) & "x86" & Chr(34)
  605.         sManifest = sManifest & Chr(13) & "      publicKeyToken=" & Chr(34) & "6595b64144ccf1df" & Chr(34)
  606.         sManifest = sManifest & Chr(13) & "      language=" & Chr(34) & "*" & Chr(34)
  607.         sManifest = sManifest & Chr(13) & "    />"
  608.         sManifest = sManifest & Chr(13) & "  </dependentAssembly>"
  609.         sManifest = sManifest & Chr(13) & "</dependency>"
  610.         sManifest = sManifest & Chr(13) & "</assembly>"
  611. End Function
  612. Private Sub ApplyManifest(lpData As String, ByVal cbData As Long)
  613.     Dim hUpdateRes As Long, lRet As Long
  614.     FSO.CopyFile strFile, strFile & ".original", True
  615.     Pause (3)
  616.         
  617.     'get handle for UpdateResource. strFile must be an executable.
  618.     hUpdateRes = BeginUpdateResource(strFile, False)
  619.     If hUpdateRes = 0 Then GoTo FileError
  620.     'modify the resource.
  621.     lRet = UpdateResource(hUpdateRes, 24, 1, 1033, ByVal lpData, cbData)
  622.     'commit the changes to the executable file.
  623.     lRet = EndUpdateResource(hUpdateRes, False)
  624.     MsgBox lblAProdName & " Updated"
  625. Exit Sub
  626. FileError:
  627.         MsgBox "Could not " & lblAFileName.Caption & " for writing!"
  628.         
  629. End Sub
  630. Public Function Pause(Seconds)
  631.     Dim CurrentTime As Long
  632.     CurrentTime = Timer
  633.     Do
  634.         DoEvents
  635.         Loop Until CurrentTime + Seconds <= Timer
  636.     End Function
  637.