Find all our projects in development below.
All source code is GNU General Public License (GPL)
Browsing MainForm.frm (5.59 KB)
VERSION 5.00
Begin VB.Form MainForm
BorderStyle = 1 'Fixed Single
Caption = "MSN Messenger Simple Away Message"
ClientHeight = 4935
ClientLeft = 45
ClientTop = 435
ClientWidth = 5790
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Icon = "MainForm.frx":0000
MaxButton = 0 'False
ScaleHeight = 4935
ScaleWidth = 5790
StartUpPosition = 2 'CenterScreen
Begin VB.Frame Frame3
Caption = "About"
Height = 975
Left = 120
TabIndex = 7
Top = 3240
Width = 5535
Begin VB.Image ImgAbout
Height = 480
Left = 240
Picture = "MainForm.frx":0BC2
Top = 360
Width = 480
End
Begin VB.Label lblAbout2
Caption = "Copyright � 1999 - 2003 Jason's PC Software"
Height = 255
Left = 840
TabIndex = 9
Top = 600
Width = 4335
End
Begin VB.Label lblAbout1
Caption = "Programmed by Jason Java (jason@jasonspcsoftware.com)"
Height = 255
Left = 840
TabIndex = 8
Top = 360
Width = 4575
End
End
Begin VB.CommandButton Command1
Caption = "Close"
Default = -1 'True
Height = 375
Left = 4200
TabIndex = 3
Top = 4440
Width = 1455
End
Begin VB.Frame Frame2
Caption = "&Away Message"
Height = 2175
Left = 120
TabIndex = 0
Top = 120
Width = 5535
Begin VB.CommandButton Command2
Caption = "&Default"
Height = 255
Left = 4440
TabIndex = 2
Top = 1800
Width = 855
End
Begin VB.TextBox txtMsg
Height = 1365
Left = 240
MaxLength = 800
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 1
Text = "MainForm.frx":1784
Top = 360
Width = 5055
End
Begin VB.Label lblNote
Caption = "Note: Command line variables can be used (e.g. %1)"
Height = 255
Left = 240
TabIndex = 5
Top = 1800
Width = 3975
End
End
Begin VB.Frame Frame1
Caption = "Statistics"
Height = 735
Left = 120
TabIndex = 4
Top = 2400
Width = 5535
Begin VB.Label lblCount
Caption = "0 Away messages sent."
Height = 255
Left = 240
TabIndex = 6
Top = 360
Width = 5055
End
End
End
Attribute VB_Name = "MainForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public WithEvents msn As MsgrObject
Attribute msn.VB_VarHelpID = -1
Dim lAwayCount As Long
Private Const RegAppRoot = "Software\MSN Simple Away Msg\"
Private Function ParseMsg(ByVal strMsg As String) As String
Dim i As Integer
Dim strArray() As String
strArray = Split(Command, " ")
ParseMsg = strMsg
For i = UBound(strArray) To 0 Step -1
ParseMsg = Replace(ParseMsg, "%" & (i + 1), strArray(i))
Next i
End Function
Private Sub Command1_Click()
Unload Me
End Sub
Private Sub Command2_Click()
If MsgBox("Do you want to set the away message to the default away message?", vbYesNo + vbQuestion) = vbYes Then
txtMsg.Text = "I am currently away from my computer right now. Please leave me a message and I will get back to you as soon as possible."
txtMsg.SetFocus
txtMsg.SelStart = 0
txtMsg.SelLength = Len(txtMsg.Text)
End If
End Sub
Private Sub Form_Load()
Dim sRegData As String
Set msn = New MsgrObject
lAwayCount = 0
sRegData = GetRegString(HKEY_LOCAL_MACHINE, RegAppRoot, "AwayMsg")
If sRegData <> "" Then txtMsg.Text = sRegData
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
SaveRegString HKEY_LOCAL_MACHINE, RegAppRoot, "AwayMsg", txtMsg.Text
Set msn = Nothing
End Sub
Private Sub msn_OnTextReceived(ByVal pIMSession As Messenger.IMsgrIMSession, ByVal pSourceUser As Messenger.IMsgrUser, ByVal bstrMsgHeader As String, ByVal bstrMsgText As String, pfEnableDefault As Boolean)
If bstrMsgText = "" Then Exit Sub
lAwayCount = lAwayCount + 1
lblCount.Caption = lAwayCount & " Away messages sent."
pSourceUser.SendText Replace(bstrMsgHeader, pSourceUser.EmailAddress, msn.LocalFriendlyName), ParseMsg(txtMsg.Text), MMSGTYPE_NO_RESULT
End Sub