home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / code / print / pms3 / pmswitch.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-02-27  |  3.3 KB  |  122 lines

  1. VERSION 2.00
  2. Begin Form PMSwitch 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "PM Switch"
  5.    ClientHeight    =   165
  6.    ClientLeft      =   1500
  7.    ClientTop       =   -435
  8.    ClientWidth     =   2175
  9.    Height          =   690
  10.    Icon            =   PMSWITCH.FRX:0000
  11.    Left            =   1440
  12.    LinkMode        =   1  'Source
  13.    LinkTopic       =   "Form1"
  14.    MaxButton       =   0   'False
  15.    ScaleHeight     =   165
  16.    ScaleWidth      =   2175
  17.    Top             =   -900
  18.    Width           =   2295
  19.    Begin Image pmOn 
  20.       Height          =   480
  21.       Left            =   810
  22.       Picture         =   PMSWITCH.FRX:0302
  23.       Top             =   240
  24.       Width           =   480
  25.    End
  26.    Begin Image pmOff 
  27.       Height          =   480
  28.       Left            =   210
  29.       Picture         =   PMSWITCH.FRX:0604
  30.       Top             =   240
  31.       Width           =   480
  32.    End
  33. DefInt A-Z
  34. Dim Auto As String
  35. Dim ListPos As Integer
  36. Dim Message As String
  37. Dim LF As String
  38. Sub Form_Load ()
  39.     Continue = True
  40.     Screen.MousePointer = 11
  41.     WindowState = 1
  42.     LF = Chr$(10) + Chr$(13)
  43.     nDefault = 255
  44.     DefaultStr = "Not Found"
  45.     Section = "windows"
  46.     KeyName = "spooler"
  47.     'Check for previous instance and close it
  48.     If App.PrevInstance = True Then
  49.         PMSwitch.Caption = "Working"
  50.         AppActivate "PM Switch"
  51.         SendKeys "%{F4}", -1
  52.         PMSwitch.Caption = "PM Switch"
  53.         If Command$ = "" Then
  54.             PMSwitch.WindowState = 0
  55.         End If
  56.     End If
  57.     'Add About item to System menu
  58.     SysMenuAdd
  59.     ' Get current spooler status
  60.     ReadWinIni Section, KeyName, DefaultStr, ReturnStr, nDefault
  61.     ' Check command line for attached program
  62.     ' If attached, disable print manager
  63.     If Command$ > "" Then
  64.         ' Disable Print Manager
  65.         If PMStatus = "yes" Then
  66.             TurnPMOff Section, KeyName, PMStatus
  67.         End If
  68.         
  69.         ' Launch Application
  70.         On Error GoTo BadCommand
  71.         Result = Shell(Command$, 1)
  72.         On Error GoTo 0
  73.     End If
  74.     ' Display PM Status
  75.     If PMStatus = "yes" Then
  76.         PMSwitch.Icon = PMOn
  77.     Else
  78.         PMSwitch.Icon = PMOff
  79.     End If
  80.     Screen.MousePointer = 0
  81.     PMSwitch.Show
  82.     ' Go into message processing loop
  83.     ProcessWinMessage
  84. Exit Sub
  85. BadCommand:
  86.     Message = "Could Not Find " + Command$
  87.     Beep
  88.     MsgBox Message, 0, "PMSwitch Error"
  89. Resume Next
  90. End Sub
  91. Sub Form_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
  92.     ProcessWinMessage
  93. End Sub
  94. Sub Form_MouseUp (Button As Integer, Shift As Integer, X As Single, Y As Single)
  95.         ProcessWinMessage
  96. End Sub
  97. Sub Form_Resize ()
  98.     If Continue = False Then
  99.         Exit Sub
  100.     End If
  101.     If WindowState = 0 Then
  102.         
  103.         ' Get PM Status
  104.         ReadWinIni Section, KeyName, DefaultStr, ReturnStr, nDefault
  105.         
  106.         If PMStatus = "no" Then
  107.             PMStatus = "yes"
  108.             PMSwitch.Icon = PMOn
  109.         Else
  110.             PMStatus = "no"
  111.             PMSwitch.Icon = PMOff
  112.         End If
  113.         
  114.         SaveWinIni Section, KeyName, PMStatus
  115.         WindowState = 1
  116.         
  117.     End If
  118. End Sub
  119. Sub Form_Unload (Cancel As Integer)
  120.     Continue = False
  121. End Sub
  122.