|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
|
Announcements
Chapters
Services
Feature Zones
|
IntroductionThis time something different but related to mobile phone. Some times I think ‘can I control my PC with my mobile phone!’. After thinking for a few days I come to know that I can. This is a simple example to control your PC with your mobile phone. I dreamed to control my PC like shutting down, sending mails, sending files, starting or stopping services etc. from any where from this universe using my mobile phone with lesser cost. Finally I did it with simple logic. Logic behind the sceneI am having a mobile phone and I can send SMS to my mail id. My mobile phone service provider allows me to send Mail through SMS service. I will send message to my mail Id like “SHUTDOWN” (Command to shutdown machine). Assume my system is switched on and opened Outlook 2000 (I did not tried with other versions). I set Outlook to check my mail account every 60 seconds I have written a listener application in VB. This application will be running in my system. This listener will check if any new mail is arrived to my inbox. If any new mail received then it will open the mail and check is the message is sent from my mobile phone. If it is sent from my mobile phone then it will read the command, which I sent. If the command is “SHUTDOWN” then it will fire shutdown event to the Operating system and the Operating System will shout down the PC. Using the codeI am used Outlook as my mail client. Create an outlook application object. From that getting name space of my inbox. After that checking each unread mail is it sent from my mobile phone. If it so then it parse the message and sent it to API function. Here is the code to parse mail Private Function ParseMail() As String
….
….
'Lets iterate through an each mail
For Each oMails In oNpc.GetDefaultFolder(olFolderInbox).Items
If oMails.UnRead Then
sParam = ""
'Change the Subject comparition string
'based on your service provider message
If UCase(oMails.Subject) = UCase(Trim(txtSubject.Text)) Then
sCommand = Mid(oMails.Body, 1, InStr(1, oMails.Body, Chr(13)) - 1)
If InStr(1, sCommand, "~") <> 0 Then
ParseMail =
Mid(sCommand, 1, InStr(1, sCommand,
"~") - 1)
sParam =
Mid(sCommand, InStr(1, sCommand,
"~") + 1) Else
ParseMail =
sCommand End If
oMails.UnRead = False End If ' If
Send Unread mail Header is checked then
send
info to
mobile If
chkUnReadMail.Value =
1 Then If
UCase(oMails.Subject) <> UCase(Trim(txtSubject.Text)) Then
If InStr(1, sAlertedMails, Trim(oMails.EntryID)) = 0 Then
sAlertedMails = sAlertedMails & Trim(oMails.EntryID) & ","
sMsgHead = "From: " & oMails.SenderName & vbCrLf
sMsgHead = sMsgHead & "Sub: " & oMails.Subject & vbCrLf
sMsgHead = sMsgHead & "DT: " & oMails.SentOn & vbCrLf
sMsgHead = sMsgHead & "MSGID: " & oMails.EntryID & "~"
SendSMS sMsgHead
End If
End If
End If
End If
Next oMails
….
….
End Function
I used more API functions and you can find it in www.allapi.net. Using this application we can send commands to the system and also the system will report the status. For example I like to know is there any new mail in my inbox then I will send command like CHECKMAIL. When the Listener receives this information then it will check count of unread mails and sends it to my mobile as SMS. Here is the code to parse mail I thank http://www.spicesms.com Team for providing special SMS service for doing this application. I used XMLHTTP to pass the information as SMS to my Mobile.
Private Sub SendSMS(sMessage As String,
Optional sFrom As String = "rasheedsys")
…
…
Dim oXml As New MSXML2.XMLHTTP
Call oXml.Open("POST", "http://www.spicesms.com/abc.asp?from="
& sFrom & "&msg=" & sMessage & "~")
'Cange your vendor URL appropriately
Call oXml.setRequestHeader("Content-Type", "text/xml")
Call oXml.Send
txtLog = txtLog & "Status of: " & "http://www.spicesms.com/abc.asp?from="
& sFrom & "&msg=" & sMessage & "~" & vbCrLf
txtLog = txtLog & oXml.responseText & vbCrLf
…
…
End Sub
Here is the Command list and it’s functionalitySHUTDOWN
FILELIST~Folder Path~email Id
SENDFILE~File Name With Path~email Id
WHO
NETSEND~System name~Message to send
CHECKMAIL
READMAILHEADER
READMSG~msgid
Using the applicationYou need VB runtime in your machine. I am not used any additional component in this application. You need MSXML 3.0 parser in your machine. You can find it in www.microsot.com download section When you compile and run this application an icon will be displayed in the system tray
Right click on it to get setup screen
Click on Setup menu to view the listener configuration screen. Click on Exit to close the listener
ConclusionWe all know that we can control a PC from another PC. This is an initial approach to control PC using mobile phone. Not only controlling a PC we can get report from PC, File list, PC status, any other information stored in PC and much more. It is a beginning… History
Commands Added
|
||||||||||||||||||||||