home *** CD-ROM | disk | FTP | other *** search
- VERSION 1.0 CLASS
- BEGIN
- MultiUse = -1 'True
- END
- Attribute VB_Name = "Application"
- Attribute VB_Creatable = True
- Attribute VB_Exposed = True
- ' Option Private Module
- ' Internal flag used by AlwayOnTop property.
- Private mbAlwaysOnTop As Boolean
-
- ''''''''''''''''''''''''''''''''''''''''''''
- ' CALC.EXE Application Class
- '
- ' Application Object
- '
- ' Property: Value
- '
- ' Methods : Add
- ' Subtract
- ' Multiply
- ' Divide
- ' Sum
- ' Activate
- '
-
- ''''''''''''''''''''''''''''''''''''''''''''
- ' Property
-
- ''''''''''''''''''''''''''''''''''''''''''''
- ' The Value Property
- ' Access: Read/Write
- ' Data type: Single
- '
- ' Returns the value in the Readout Textbox
- Public Property Get Value() As Single
- Value = Val(Calculator.Readout.Caption)
- End Property
-
- ' Sets the value in the Readout text box.
- Public Property Let Value(sValue As Single)
- Input_Change sValue
- End Property
-
- ''''''''''''''''''''''''''''''''''''''''''''
- ' The AlwaysOnTop Property
- ' Access: Read/Write
- ' Data type: Boolean
- '
- ' Determines whether or not the calculator
- ' is displayed as an always-on-top window.
- Public Property Get AlwaysOnTop() As Boolean
- AlwaysOnTop = mbAlwaysOnTop
- End Property
-
- Public Property Let AlwaysOnTop(bSetting As Boolean)
- If bSetting Then
- SetWindowPos Calculator.hWnd, _
- HWND_TOPMOST, _
- 0, 0, 0, 0, _
- SWP_NOSIZE Or SWP_NOMOVE _
- Or SWP_NOACTIVATE Or SWP_SHOWWINDOW
- mbAlwaysOnTop = True
- Else
- SetWindowPos Calculator.hWnd, _
- HWND_NOTOPMOST, _
- 0, 0, 0, 0, _
- SWP_NOSIZE Or SWP_NOMOVE _
- Or SWP_NOACTIVATE
- mbAlwaysOnTop = False
- End If
- End Property
-
- '''''''''''''''''''''''''''''''''''''''''''''
- ' Methods
-
- '''''''''''''''''''''''''''''''''''''''''''''
- ' Add Method
- Public Sub Add()
- Input_Change "+"
- End Sub
-
- '''''''''''''''''''''''''''''''''''''''''''''
- ' Subtract Method
- Public Sub Subtract()
- Input_Change "-"
- End Sub
-
- '''''''''''''''''''''''''''''''''''''''''''''
- ' Multiply Method
- Public Sub Multiply()
- Input_Change "*"
- End Sub
-
- '''''''''''''''''''''''''''''''''''''''''''''
- ' Divide Method
- Public Sub Divide()
- Input_Change "/"
- End Sub
-
- '''''''''''''''''''''''''''''''''''''''''''''
- ' Sum Method
- Public Sub Sum()
- Input_Change "="
- End Sub
-
- '''''''''''''''''''''''''''''''''''''''''''''
- ' Activate Method
- Public Sub Activate()
- AppActivate Calculator.Caption
- End Sub
-
- ' Added for Application class methods.
- ' Permits access to operator click events.
- Private Sub Input_Change(Item)
- Dim i As Integer
- Dim strStroke As String
- For i = 1 To Len(Item)
- strStroke = Mid(Item, i, 1)
- Select Case strStroke
- Case "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"
- Calculator.Number_Click Val(strStroke)
- Case "."
- Calculator.Decimal_Click
- Case "+"
- Calculator.Operator_Click 1
- Case "-"
- Calculator.Operator_Click 3
- Case "*"
- Calculator.Operator_Click 2
- Case "/"
- Calculator.Operator_Click 0
- Case "="
- Calculator.Operator_Click 4
- End Select
- Next i
- End Sub
-
- Public Sub foopublic()
- MsgBox "public"
- End Sub
-
- Sub fooreg()
- MsgBox "regular"
- End Sub
-
- Private Sub fooprivate()
- MsgBox "private"
- End Sub
-
-