Click here to Skip to main content
Click here to Skip to main content

Control your PC with Mobile Phone

, 5 Aug 2004 CPOL
Rate this:
Please Sign up or sign in to vote.
Shutdown your PC from anywhere in this universe using mobile phone, with lesser cost.

Introduction

This 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 scene

I 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 code

I 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 functionality

SHUTDOWN

If we send SMS as SHUTDOWN then the machine will get shout downed

FILELIST~Folder Path~email Id

This command receives two parameters, Folder path and email Id to which we have to send the file list.

If we know the filename and file path we can use SENDFILE command to send a file from the machine to any email Id. In case we do not know the file name and path we can use FILELIST command. This command will get list of files, which is in the particular folder or Drive.

Example

FILELIST~C:\temp~rasheed1979@hotmail.com
When this message reaches my inbox then it search Temp folder in C drive and builds file list. The same is sent to the specified email id. In our example this file will be sent to rasheed1979@hotmail.com

SENDFILE~File Name With Path~email Id

This command used to send a specific file from my system to specific email Id.

Example

SENDFILE~C:\myfile.txt~rasheed1979@hotmail.com
The file myfile.txt will be sent to the mail id rasheed1979@hotmail.com

WHO

This command used to find the user who currently logged in the machine

NETSEND~System name~Message to send

Using this command we can send message from one machine to another machine without physical presence.

Example

NETSEND~SYS1~Hi
A message Hi will be sent to the machine named SYS1

CHECKMAIL

This command used to check number of unread mails in inbox. This command counts number unread mails in inbox and sends SMS to your mobile device (I used www.spicesms.com service)

READMAILHEADER

This command used to check important information about the mail like from whom the message received, subject, Date time and message id (Used to read message).Read mail header info like From, Subject and Message id

READMSG~msgid

We can get message important detail using READMAILHEADER function. This function will returns message id. If we pass that message id like READMSG~adwerv354yjgh5fgrweg then the content of mail is sent to your mobile phone.

Using the application

You 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

Conclusion

We 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

  • Initial version 0.1.0
  • Version 0.1.1
    • Commands Added

    • FILELIST
    • SENDFILE
    • WHO
    • NETSEND
    • CHECKMAIL
    • READMAILHEADER
    • READMSG

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

rasheed1979

India India
Called as Rasheed. Completed Master of Computer science. Working as Senior Consultant in Chennai, India.
 
Try to achive in different stream

Comments and Discussions

 
QuestionNeed help PinmemberMember 1100419313-Aug-14 17:15 
Questionquestion Pinmemberchaitanya668-Jun-12 3:59 
Questionurjent PinmemberMember 873418015-Mar-12 22:25 
AnswerRe: urjent Pinmemberrasheed197916-Mar-12 14:22 
GeneralMy vote of 5 PinmemberMember 43208441-Mar-12 9:08 
Questionsoure code of sending messages from mobile keypad to PC in java swings PinmemberMember 867064322-Feb-12 22:28 
GeneralMy vote of 5 Pinmemberdaud ahmad5-Aug-10 10:29 
Questionhow to run the project? Pinmembersunilguptamait21-Mar-10 6:08 
Generalexplain me Pinmemberbalajistm16-Mar-10 4:10 
Generalplease explain the code Pinmemberbalajistm16-Mar-10 4:06 
GeneralMy vote of 2 Pinmemberramakrishnadonlee15-Mar-10 7:19 
Generalplease help me Pinmembersasank129-Mar-10 23:25 
Generalsecurity Pinmembervaidheeswaran22-Dec-09 1:19 
Generalproblem Pinmembera.bashar0425-Dec-09 22:32 
QuestionHow can i send sms to my email id Fast PinmemberBoltBhupenda19-Nov-09 1:30 
Generalsms project Pinmemberkalaikathiravan20-Oct-09 20:47 
GeneralRe: sms project Pinmemberrasheed19798-Nov-09 19:42 
Generalurgent!!!!!!!!!!!!!!!!! Pinmemberkshiti kaushik7-Oct-09 4:33 
GeneralRe: urgent!!!!!!!!!!!!!!!!! Pinmemberrasheed19798-Nov-09 19:43 
Generali have question PinmembervbEndUser18-Sep-09 22:59 
Generalproject Pinmemberamol897-Sep-09 18:34 
Generalvery very urgent Pinmemberprathyush8829-Aug-09 4:17 
GeneralRe: very very urgent Pinmemberrasheed197929-Aug-09 22:19 
GeneralRe: very very urgent Pinmemberprathyush885-Sep-09 9:36 
GeneralRe: very very urgent Pinmemberrasheed19796-Sep-09 18:38 
Questionproject related queries(urgent) Pinmembermadhvi_037-Aug-09 10:33 
AnswerRe: project related queries(urgent) Pinmembervarun soni7-Jul-12 2:44 
GeneralGreat! PinmemberTomFeng30-Jul-09 20:27 
GeneralRe: Great! Pinmemberrasheed19792-Aug-09 18:43 
Questionhey! PinmemberCheri 200922-Jun-09 23:07 
AnswerRe: hey! Pinmemberrasheed197923-Jun-09 19:14 
GeneralRe: hey! PinmemberCheri 200926-Jun-09 17:57 
GeneralRe: hey! Pinmemberrasheed197928-Jun-09 18:44 
Generalplzzz [modified] Pinmembergeraia17-Jun-09 6:34 
GeneralRe: plzzz Pinmemberrasheed197923-Jun-09 19:09 
QuestionPlease help me in my project... PinmemberFiMoJa16-Jun-09 3:14 
AnswerRe: Please help me in my project... Pinmemberrasheed197923-Jun-09 19:08 
GeneralRe: Please help me in my project... PinmemberFiMoJa10-Jul-09 4:09 
GeneralRe: Please help me in my project... Pinmemberrasheed197910-Jul-09 7:04 
Generalunable to run source code.. Pinmemberanujchetan24-Apr-09 21:38 
GeneralRe: unable to run source code.. Pinmemberrasheed197928-Apr-09 22:32 
QuestionControl your pc with a mobile phone project PinmemberWassajja Kayemba Kenneth10-Mar-09 4:15 
Generalcontrol pc using mobile Pinmemberabhishek brahma28-Jan-09 17:42 
Generalabout modules Pinmembergetyourkarthick3-Jan-09 21:23 
GeneralHelp for the project Control your PC with your mobile PinmemberRajnishromi29-Nov-08 5:00 
GeneralRe: Help for the project Control your PC with your mobile Pinmemberrasheed197930-Nov-08 18:36 
Generalhelp Pinmemberhacker8728-Aug-08 20:28 
GeneralHelp to perform project Pinmemberhemant_jain020622-Aug-08 7:59 
QuestionPlz Help me !! Pinmemberswapnilwagh31-Jul-08 8:56 
Generalhelp to perform project!!!!!! PinmemberMember 533015229-Jul-08 1:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web01 | 2.8.141022.1 | Last Updated 6 Aug 2004
Article Copyright 2004 by rasheed1979
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid