home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form PMSwitch
- BorderStyle = 1 'Fixed Single
- Caption = "PM Switch"
- ClientHeight = 165
- ClientLeft = 1500
- ClientTop = -435
- ClientWidth = 2175
- Height = 690
- Icon = PMSWITCH.FRX:0000
- Left = 1440
- LinkMode = 1 'Source
- LinkTopic = "Form1"
- MaxButton = 0 'False
- ScaleHeight = 165
- ScaleWidth = 2175
- Top = -900
- Width = 2295
- Begin Image pmOn
- Height = 480
- Left = 810
- Picture = PMSWITCH.FRX:0302
- Top = 240
- Width = 480
- End
- Begin Image pmOff
- Height = 480
- Left = 210
- Picture = PMSWITCH.FRX:0604
- Top = 240
- Width = 480
- End
- DefInt A-Z
- Dim Auto As String
- Dim ListPos As Integer
- Dim Message As String
- Dim LF As String
- Sub Form_Load ()
- Continue = True
- Screen.MousePointer = 11
- WindowState = 1
- LF = Chr$(10) + Chr$(13)
- nDefault = 255
- DefaultStr = "Not Found"
- Section = "windows"
- KeyName = "spooler"
- 'Check for previous instance and close it
- If App.PrevInstance = True Then
- PMSwitch.Caption = "Working"
- AppActivate "PM Switch"
- SendKeys "%{F4}", -1
- PMSwitch.Caption = "PM Switch"
- If Command$ = "" Then
- PMSwitch.WindowState = 0
- End If
- End If
- 'Add About item to System menu
- SysMenuAdd
- ' Get current spooler status
- ReadWinIni Section, KeyName, DefaultStr, ReturnStr, nDefault
- ' Check command line for attached program
- ' If attached, disable print manager
- If Command$ > "" Then
- ' Disable Print Manager
- If PMStatus = "yes" Then
- TurnPMOff Section, KeyName, PMStatus
- End If
-
- ' Launch Application
- On Error GoTo BadCommand
- Result = Shell(Command$, 1)
- On Error GoTo 0
- End If
- ' Display PM Status
- If PMStatus = "yes" Then
- PMSwitch.Icon = PMOn
- Else
- PMSwitch.Icon = PMOff
- End If
- Screen.MousePointer = 0
- PMSwitch.Show
- ' Go into message processing loop
- ProcessWinMessage
- Exit Sub
- BadCommand:
- Message = "Could Not Find " + Command$
- Beep
- MsgBox Message, 0, "PMSwitch Error"
- Resume Next
- End Sub
- Sub Form_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
- ProcessWinMessage
- End Sub
- Sub Form_MouseUp (Button As Integer, Shift As Integer, X As Single, Y As Single)
- ProcessWinMessage
- End Sub
- Sub Form_Resize ()
- If Continue = False Then
- Exit Sub
- End If
- If WindowState = 0 Then
-
- ' Get PM Status
- ReadWinIni Section, KeyName, DefaultStr, ReturnStr, nDefault
-
- If PMStatus = "no" Then
- PMStatus = "yes"
- PMSwitch.Icon = PMOn
- Else
- PMStatus = "no"
- PMSwitch.Icon = PMOff
- End If
-
- SaveWinIni Section, KeyName, PMStatus
- WindowState = 1
-
- End If
- End Sub
- Sub Form_Unload (Cancel As Integer)
- Continue = False
- End Sub
-