home *** CD-ROM | disk | FTP | other *** search
/ The Net: Ultimate Internet Guide / WWLCD1.ISO / pc / frntpage.sdk / wizards / pages / hello.wiz / hello.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-05-31  |  16.2 KB  |  495 lines

  1. VERSION 4.00
  2. Begin VB.Form frmPagewiz1 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "Hello Page Wizard"
  5.    ClientHeight    =   4245
  6.    ClientLeft      =   1065
  7.    ClientTop       =   1515
  8.    ClientWidth     =   7455
  9.    Height          =   4650
  10.    Left            =   1005
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   4245
  15.    ScaleWidth      =   7455
  16.    ShowInTaskbar   =   0   'False
  17.    Top             =   1170
  18.    Width           =   7575
  19.    Begin VB.Frame grpPage 
  20.       BeginProperty Font 
  21.          name            =   "MS Sans Serif"
  22.          charset         =   0
  23.          weight          =   700
  24.          size            =   8.25
  25.          underline       =   0   'False
  26.          italic          =   0   'False
  27.          strikethrough   =   0   'False
  28.       EndProperty
  29.       Height          =   3375
  30.       Index           =   0
  31.       Left            =   2520
  32.       TabIndex        =   12
  33.       Top             =   120
  34.       Width           =   4755
  35.       Begin VB.Label lblInfo 
  36.          Caption         =   $"hello.frx":0000
  37.          BeginProperty Font 
  38.             name            =   "Arial"
  39.             charset         =   0
  40.             weight          =   400
  41.             size            =   8.25
  42.             underline       =   0   'False
  43.             italic          =   -1  'True
  44.             strikethrough   =   0   'False
  45.          EndProperty
  46.          Height          =   1695
  47.          Left            =   180
  48.          TabIndex        =   17
  49.          Top             =   1560
  50.          Visible         =   0   'False
  51.          Width           =   4455
  52.       End
  53.       Begin VB.Label Label3 
  54.          Caption         =   $"hello.frx":01C0
  55.          Height          =   735
  56.          Left            =   180
  57.          TabIndex        =   15
  58.          Top             =   840
  59.          Width           =   4395
  60.       End
  61.       Begin VB.Label Label2 
  62.          Caption         =   "The Hello Page Wizard will guide you through the process of creating a web page that greets visitors to your web site."
  63.          Height          =   495
  64.          Left            =   180
  65.          TabIndex        =   14
  66.          Top             =   300
  67.          Width           =   4395
  68.       End
  69.    End
  70.    Begin VB.Frame grpPage 
  71.       BeginProperty Font 
  72.          name            =   "MS Sans Serif"
  73.          charset         =   0
  74.          weight          =   700
  75.          size            =   8.25
  76.          underline       =   0   'False
  77.          italic          =   0   'False
  78.          strikethrough   =   0   'False
  79.       EndProperty
  80.       Height          =   3375
  81.       Index           =   1
  82.       Left            =   2640
  83.       TabIndex        =   13
  84.       Top             =   180
  85.       Width           =   4755
  86.       Begin VB.Frame Frame1 
  87.          Caption         =   "&Color Scheme"
  88.          Height          =   915
  89.          Left            =   360
  90.          TabIndex        =   8
  91.          Top             =   1860
  92.          Width           =   4035
  93.          Begin VB.OptionButton optWB 
  94.             Caption         =   "&White on Black"
  95.             Height          =   255
  96.             Left            =   2220
  97.             TabIndex        =   10
  98.             Top             =   420
  99.             Width           =   1455
  100.          End
  101.          Begin VB.OptionButton optBW 
  102.             Caption         =   "Bl&ack on White"
  103.             Height          =   255
  104.             Left            =   480
  105.             TabIndex        =   9
  106.             Top             =   420
  107.             Value           =   -1  'True
  108.             Width           =   1455
  109.          End
  110.       End
  111.       Begin VB.CheckBox chkCredit 
  112.          Caption         =   "&Include production credit"
  113.          Height          =   255
  114.          Left            =   360
  115.          TabIndex        =   11
  116.          Top             =   2940
  117.          Value           =   1  'Checked
  118.          Width           =   3135
  119.       End
  120.       Begin VB.ComboBox cmbStyle 
  121.          Height          =   300
  122.          Left            =   1260
  123.          Style           =   2  'Dropdown List
  124.          TabIndex        =   7
  125.          Top             =   1380
  126.          Width           =   3135
  127.       End
  128.       Begin VB.TextBox txtGreeting 
  129.          Height          =   285
  130.          Left            =   1260
  131.          TabIndex        =   5
  132.          Text            =   "Hello, world!"
  133.          Top             =   900
  134.          Width           =   3075
  135.       End
  136.       Begin VB.Label Label5 
  137.          Caption         =   "&Style:"
  138.          Height          =   255
  139.          Left            =   360
  140.          TabIndex        =   6
  141.          Top             =   1440
  142.          Width           =   735
  143.       End
  144.       Begin VB.Label Label4 
  145.          Caption         =   "Enter a greeting phrase for your Hello page, and select some appropriate page style settings."
  146.          Height          =   495
  147.          Left            =   180
  148.          TabIndex        =   16
  149.          Top             =   300
  150.          Width           =   4395
  151.       End
  152.       Begin VB.Label Label1 
  153.          Caption         =   "&Greeting:"
  154.          Height          =   255
  155.          Left            =   360
  156.          TabIndex        =   4
  157.          Top             =   960
  158.          Width           =   735
  159.       End
  160.    End
  161.    Begin VB.Frame grpPage 
  162.       BeginProperty Font 
  163.          name            =   "MS Sans Serif"
  164.          charset         =   0
  165.          weight          =   700
  166.          size            =   8.25
  167.          underline       =   0   'False
  168.          italic          =   0   'False
  169.          strikethrough   =   0   'False
  170.       EndProperty
  171.       Height          =   3375
  172.       Index           =   2
  173.       Left            =   2760
  174.       TabIndex        =   18
  175.       Top             =   240
  176.       Width           =   4755
  177.       Begin VB.TextBox txtTitle 
  178.          Height          =   315
  179.          Left            =   720
  180.          TabIndex        =   23
  181.          Text            =   "My Hello Page"
  182.          Top             =   2280
  183.          Width           =   3315
  184.       End
  185.       Begin VB.TextBox txtURL 
  186.          Height          =   315
  187.          Left            =   720
  188.          TabIndex        =   21
  189.          Text            =   "hello.htm"
  190.          Top             =   1560
  191.          Width           =   3315
  192.       End
  193.       Begin VB.Label Label7 
  194.          Caption         =   "Page &Title:"
  195.          Height          =   195
  196.          Left            =   720
  197.          TabIndex        =   22
  198.          Top             =   2040
  199.          Width           =   1455
  200.       End
  201.       Begin VB.Label Label6 
  202.          Caption         =   "Page &URL:"
  203.          Height          =   195
  204.          Left            =   720
  205.          TabIndex        =   20
  206.          Top             =   1320
  207.          Width           =   1455
  208.       End
  209.       Begin VB.Label Label8 
  210.          Caption         =   $"hello.frx":027D
  211.          Height          =   675
  212.          Left            =   180
  213.          TabIndex        =   19
  214.          Top             =   300
  215.          Width           =   4395
  216.       End
  217.    End
  218.    Begin VB.CommandButton btnFinish 
  219.       Caption         =   "&Finish"
  220.       Height          =   375
  221.       Left            =   6240
  222.       TabIndex        =   3
  223.       Top             =   3720
  224.       Width           =   1035
  225.    End
  226.    Begin VB.CommandButton btnNext 
  227.       Caption         =   "&Next >"
  228.       Height          =   375
  229.       Left            =   4860
  230.       TabIndex        =   0
  231.       Top             =   3720
  232.       Width           =   1035
  233.    End
  234.    Begin VB.CommandButton btnBack 
  235.       Caption         =   "< &Back"
  236.       Height          =   375
  237.       Left            =   3840
  238.       TabIndex        =   1
  239.       Top             =   3720
  240.       Width           =   1035
  241.    End
  242.    Begin VB.CommandButton btnCancel 
  243.       Cancel          =   -1  'True
  244.       Caption         =   "Cancel"
  245.       Height          =   375
  246.       Left            =   2520
  247.       TabIndex        =   2
  248.       Top             =   3720
  249.       Width           =   1035
  250.    End
  251.    Begin VB.Image imgMain 
  252.       BorderStyle     =   1  'Fixed Single
  253.       Height          =   3270
  254.       Left            =   120
  255.       Picture         =   "hello.frx":032E
  256.       Stretch         =   -1  'True
  257.       Top             =   240
  258.       Width           =   2295
  259.    End
  260. Attribute VB_Name = "frmPagewiz1"
  261. Attribute VB_Creatable = False
  262. Attribute VB_Exposed = False
  263. Option Explicit
  264. Dim CurPage As Integer
  265. Dim FirstPage As Integer
  266. Dim LastPage As Integer
  267. Private Sub btnBack_Click()
  268.     GoToPage (CurPage - 1)
  269. End Sub
  270. Private Sub btnCancel_Click()
  271.     ' set exit status if need to
  272.     If WizardBlocking Then
  273.         SetWizardExitStatus WizardStatusCancel
  274.     End If
  275.     ' all done
  276.     Unload Me
  277. End Sub
  278. Private Sub btnFinish_Click()
  279.     Dim explorer As Object
  280.     Dim editor As Object
  281.     Dim newdoc As Object
  282.     Dim pagefile As String
  283.     Dim ret As Long
  284.     Dim weburl As String
  285.     Dim nl As String
  286.     Dim dest As String
  287.     nl = Chr$(13) & Chr$(10)
  288.     ' disable all buttons
  289.     btnCancel.Enabled = False
  290.     btnBack.Enabled = False
  291.     btnNext.Enabled = False
  292.     btnFinish.Enabled = False
  293.     ' put up hourglass
  294.     MousePointer = 11
  295.     ' create page in temp file
  296.     pagefile = TempFileName
  297.     GeneratePage pagefile
  298.     ' set preliminary exit status (can override later)
  299.     SetWizardExitStatus WizardStatusOK
  300.     ' upload page to requested destination
  301.     dest = WizardDestination
  302.     If dest = "" Then dest = "editor"
  303.     Select Case dest
  304.         Case "disk"
  305.             SetWizardFileCount "1"
  306.             SetWizardOutputVar "File1", pagefile
  307.             SetWizardOutputVar "Url1", txtURL
  308.         Case "web"
  309.             Set explorer = CreateObject(FrontPageExplorerID)
  310.             weburl = explorer.vtiGetWebURL
  311.             If weburl = "" Then
  312.                 MsgBox "There is no web open in the Explorer." & nl & "Open or create a web and try again."
  313.                 GoToPage CurPage ' restore interface
  314.                 Set explorer = Nothing
  315.                 Kill pagefile
  316.                 MousePointer = 0
  317.                 Exit Sub
  318.             End If
  319.             If explorer.vtiIsPageInWeb(txtURL) Then
  320.                 If MsgBox("A page with the given URL already exists in the current web." & nl & nl & "Overwrite it?", 4 + 32, "Page URL Conflict") = 6 Then
  321.                     ret = explorer.vtiPutDocument(pagefile, txtURL, True)
  322.                 Else
  323.                     ' give user a chance to go back and change it
  324.                     GoToPage CurPage ' restore interface
  325.                     Set explorer = Nothing
  326.                     Kill pagefile
  327.                     MousePointer = 0
  328.                     Exit Sub
  329.                 End If
  330.             Else
  331.                 ret = explorer.vtiPutDocument(pagefile, txtURL, True)
  332.             End If
  333.             ' the Explorer will display a message if something goes wrong
  334.             If ret <> 1 Then
  335.                 ' override exit status
  336.                 SetWizardExitStatus WizardStatusError
  337.             End If
  338.             Set explorer = Nothing
  339.         Case "editor"
  340.             Set editor = CreateObject(FrontPageEditorID)
  341.             Set newdoc = editor.vtiOpenWebPage(pagefile, txtURL, "", "")
  342.             Set newdoc = Nothing
  343.             Set editor = Nothing
  344.         Case Else
  345.             Set editor = CreateObject(FrontPageEditorID)
  346.             Set newdoc = editor.vtiOpenWebPage(pagefile, txtURL, "", "")
  347.             Set newdoc = Nothing
  348.             Set editor = Nothing
  349.     End Select
  350.     ' make sure to delete the generated temp file
  351.     If dest <> "disk" Then Kill pagefile
  352.     ' take down hourglass
  353.     MousePointer = 0
  354.     ' all done
  355.     Unload Me
  356. End Sub
  357. Private Sub btnNext_Click()
  358.     GoToPage (CurPage + 1)
  359. End Sub
  360. Public Sub InitPages(minpage As Integer, maxpage As Integer)
  361.     Dim i As Integer
  362.     ' align all pages to the location
  363.     ' of the 0th page
  364.     FirstPage = minpage
  365.     LastPage = maxpage
  366.     For i = FirstPage To LastPage
  367.         grpPage(i).Visible = False
  368.         grpPage(i).Caption = ""
  369.         grpPage(i).Left = grpPage(0).Left
  370.         grpPage(i).Top = grpPage(0).Top
  371.         grpPage(i).Width = grpPage(0).Width
  372.         grpPage(i).Height = grpPage(0).Height
  373.     Next i
  374.     CurPage = FirstPage
  375. End Sub
  376. Public Sub GoToPage(num As Integer)
  377.     ' clip num to valid range
  378.     If num < FirstPage Then
  379.         num = FirstPage
  380.     ElseIf num > LastPage Then
  381.         num = LastPage
  382.     End If
  383.     ' take down current page
  384.     grpPage(CurPage).Visible = False
  385.     ' reset current page
  386.     CurPage = num
  387.     ' bring up new page
  388.     grpPage(CurPage).Visible = True
  389.     ' set button state
  390.     btnBack.Enabled = (CurPage > FirstPage)
  391.     btnNext.Enabled = (CurPage < LastPage)
  392.     btnFinish.Enabled = (CurPage = LastPage)
  393.     ' label the step (optional); may want
  394.     ' to use static labels instead, or change
  395.     ' the form caption rather than the frame
  396.     grpPage(CurPage).Caption = "Step " & (CurPage + 1) & " of " & (LastPage + 1)
  397. End Sub
  398. Private Sub Form_Load()
  399.     Dim maxpage As Integer
  400.     maxpage = 2  ' this includes the page/url dialog
  401.     GetFrontPageInfo
  402.     GetWizardInfo
  403.     LoadSettings
  404.     CenterFormOnScreen Me
  405.     ' last page contains URL/Title info;
  406.     ' don't display it if caller has given
  407.     ' us this info
  408.     If Len(WizardPageURL) > 0 Then
  409.         ' do not include the page/url dialog
  410.         maxpage = 1
  411.         txtURL = WizardPageURL
  412.     End If
  413.     If Len(WizardPageTitle) > 0 Then
  414.         txtTitle = WizardPageTitle
  415.     End If
  416.     InitPages 0, maxpage
  417.     GoToPage 0
  418. End Sub
  419. Private Sub Form_Unload(Cancel As Integer)
  420.     SaveSettings
  421.     ' if we were given an arg file, and the caller
  422.     ' is not blocked, then delete it before exiting
  423.     If Not WizardBlocking Then
  424.         If Len(WizardArgFile) > 0 Then Kill WizardArgFile
  425.     End If
  426. End Sub
  427. Public Sub SaveSettings()
  428.     ' store current values
  429.     SetIniString "Greeting", txtGreeting
  430.     SetIniInt "Style", cmbStyle.ListIndex
  431.     SetIniBool "BlackOnWhite", optBW
  432.     SetIniBool "WhiteOnBlack", optWB
  433.     SetIniInt "IncludeCredits", chkCredit
  434. End Sub
  435. Public Sub LoadSettings()
  436.     ' perform any initialization of control values
  437.     cmbStyle.Clear
  438.     cmbStyle.AddItem "Heading 1"
  439.     cmbStyle.AddItem "Heading 2"
  440.     cmbStyle.AddItem "Heading 3"
  441.     cmbStyle.ListIndex = 0
  442.     ' retrieve any previous values
  443.     If WizardHasPreviousSettings Then
  444.         txtGreeting = GetIniString("Greeting")
  445.         cmbStyle.ListIndex = GetIniInt("Style")
  446.         optBW = GetIniBool("BlackOnWhite")
  447.         optWB = GetIniBool("WhiteOnBlack")
  448.         chkCredit = GetIniInt("IncludeCredits")
  449.     End If
  450. End Sub
  451. Public Sub RemoveSettings()
  452.     ' might want to use this to clear
  453.     ' all previous settings and return
  454.     ' to the initial state
  455.     If WizardHasPreviousSettings And Len(WizardIniFile) > 0 Then
  456.         Kill WizardIniFile
  457.     End If
  458. End Sub
  459. Private Sub txtURL_Change()
  460.     Static recursing As Boolean
  461.     If recursing Then Exit Sub
  462.     recursing = True
  463.     ValidatePageURLField txtURL
  464.     recursing = False
  465. End Sub
  466. Public Sub GeneratePage(pagefile As String)
  467.     Dim fn As Integer
  468.     Dim nl As String
  469.     Dim tag As String
  470.     nl = Chr$(10)
  471.     fn = FreeFile
  472.     On Error GoTo BadFile
  473.     Open pagefile For Output As #fn
  474.     Print #fn, "<HTML>"
  475.     Print #fn, "<HEAD>"
  476.     Print #fn, "<TITLE>" & txtTitle & "</TITLE>"
  477.     Print #fn, "</HEAD>"
  478.     If optBW Then
  479.         Print #fn, "<BODY BGCOLOR=#ffffff TEXT=#000000>"
  480.     Else
  481.         Print #fn, "<BODY BGCOLOR=#000000 TEXT=#ffffff>"
  482.     End If
  483.     tag = "H" & (cmbStyle.ListIndex + 1)  ' H1, H2, or H3
  484.     Print #fn, "<" & tag & ">" & txtGreeting & "</" & tag & ">"
  485.     If chkCredit Then
  486.         Print #fn, "<HR>"
  487.         Print #fn, "<P><EM>This page was generated by the Hello Page Wizard.</EM></P>"
  488.     End If
  489.     Print #fn, "</BODY>"
  490.     Print #fn, "</HTML>"
  491.     Close #fn
  492. BadFile:
  493.     Exit Sub
  494. End Sub
  495.