home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / Forces_Win715694132002.psc / frmMain.frm (.txt) next >
Encoding:
Visual Basic Form  |  2002-04-07  |  4.5 KB  |  138 lines

  1. VERSION 5.00
  2. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
  3. Begin VB.Form frmMain 
  4.    BorderStyle     =   3  'Fixed Dialog
  5.    Caption         =   "VirtLink Project Updater"
  6.    ClientHeight    =   1440
  7.    ClientLeft      =   45
  8.    ClientTop       =   435
  9.    ClientWidth     =   6255
  10.    Icon            =   "frmMain.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   1440
  15.    ScaleWidth      =   6255
  16.    StartUpPosition =   3  'Windows Default
  17.    Begin VB.CommandButton cmdAbout 
  18.       Caption         =   "&About"
  19.       Height          =   375
  20.       Left            =   120
  21.       TabIndex        =   3
  22.       Top             =   960
  23.       Width           =   855
  24.    End
  25.    Begin VB.CommandButton cmdUpdate 
  26.       Caption         =   "&Update Project"
  27.       Height          =   615
  28.       Left            =   1800
  29.       TabIndex        =   2
  30.       Top             =   720
  31.       Width           =   2655
  32.    End
  33.    Begin MSComDlg.CommonDialog dlgCommon 
  34.       Left            =   0
  35.       Top             =   0
  36.       _ExtentX        =   847
  37.       _ExtentY        =   847
  38.       _Version        =   393216
  39.    End
  40.    Begin VB.CommandButton cmdBrowse 
  41.       Caption         =   "&Browse"
  42.       Height          =   375
  43.       Left            =   5040
  44.       TabIndex        =   1
  45.       Top             =   120
  46.       Width           =   1095
  47.    End
  48.    Begin VB.TextBox txtProject 
  49.       Height          =   285
  50.       Left            =   120
  51.       Locked          =   -1  'True
  52.       TabIndex        =   0
  53.       Top             =   120
  54.       Width           =   4815
  55.    End
  56. Attribute VB_Name = "frmMain"
  57. Attribute VB_GlobalNameSpace = False
  58. Attribute VB_Creatable = False
  59. Attribute VB_PredeclaredId = True
  60. Attribute VB_Exposed = False
  61. Private Sub cmdAbout_Click()
  62.     Load frmAbout
  63.     frmAbout.Show
  64. End Sub
  65. Private Sub cmdBrowse_Click()
  66.     On Error GoTo 0
  67.     On Error GoTo stpError
  68.     dlgCommon.CancelError = True
  69.     dlgCommon.DefaultExt = "vbp"
  70.     dlgCommon.DialogTitle = "Browse for Visual Basic Project"
  71.     dlgCommon.Filter = "Visual basic Project (*.vbp)|*.vbp"
  72.     dlgCommon.Flags = &H1000 And &H4
  73.     dlgCommon.ShowOpen
  74.     txtProject.Text = dlgCommon.FileTitle
  75.     strProject = dlgCommon.FileName
  76.     Exit Sub
  77. stpError:
  78.     Select Case Err
  79.         Case 32755
  80.     End Select
  81. End Sub
  82. Private Sub cmdUpdate_Click()
  83.     Dim f As Integer
  84.     Me.Enabled = False
  85.     GetModules
  86.     GetForms
  87.     If intModules = 0 Then
  88.         ans = MsgBox("No modules do exist in your project. Do you want to create one?", vbYesNoCancel + vbQuestion, "VirtLink Project Updater")
  89.         If ans = vbYes Then
  90.             strModulePath(1) = Left(strProject, InStrRev(strProject, "\")) & "mMain.bas"
  91.             strModuleName(1) = "mMain"
  92.             f = FreeFile
  93.             Open strModulePath(1) For Output As #f
  94.                 Print #f, "Attribute VB_Name = " & Chr(34) & "mMain" & Chr(34)
  95.             Close
  96.             f = FreeFile
  97.             Open strProject For Input As #f
  98.                 strA = "Module=mMain; mMain.bas" & vbCrLf
  99.                 While Not EOF(f)
  100.                     Line Input #f, strB
  101.                     strA = strA & strB & vbCrLf
  102.                 Wend
  103.             Close #f
  104.             
  105.             FileCopy strProject, strProject & ".bck"
  106.             
  107.             f = FreeFile
  108.             Open strProject For Output As #f
  109.                 Print #f, strA
  110.             Close #f
  111.             DoModule strModulePath(1)
  112.             DoForms
  113.             MakeManifest Left(strProject, InStrRev(strProject, "\"))
  114.             MsgBox "Updating project successfully completed!", vbInformation, "VirtLink Project Updater"
  115.             Me.Enabled = True
  116.         Else
  117.             Me.Enabled = True
  118.             Exit Sub
  119.         End If
  120.     ElseIf intForms = 0 Then
  121.         MsgBox "You don't have any forms in your project.", vbExclamation, "VirtLink Project Updater"
  122.         Me.Enabled = True
  123.         Exit Sub
  124.     ElseIf intModules > 1 Then
  125.         Load frmChoose
  126.         frmChoose.Show
  127.     Else
  128.         DoModule Left(strProject, InStrRev(strProject, "\")) & Trim(strModulePath(1))
  129.         DoForms
  130.         MakeManifest Left(strProject, InStrRev(strProject, "\"))
  131.         MsgBox "Updating project successfully completed!", vbInformation, "VirtLink Project Updater"
  132.         Me.Enabled = True
  133.     End If
  134. End Sub
  135. Private Sub Form_Initialize()
  136.     InitCommonControls
  137. End Sub
  138.