Results 1 to 3 of 3

Thread: Windows10 Monitor keyboard and mouse, send mail after inactivity

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2022
    Location
    Texas
    Posts
    2

    Windows10 Monitor keyboard and mouse, send mail after inactivity

    I'd like to code up a function for my Windows10 machine that continually monitors my keyboard and mouse activity and sends an email if no activity occurs after X hours (and likely during a timespan like 7:00 AM to midnight).

    I'm comfortable with procedural coding (PHP & PERL), I was pretty OK with BASIC a few decades ago, I can find my way around OOP but it's still a bit out of my comfort zone, and would prefer not to have to learn C or spend any money to do this.

    BASIC seems painless; would VB be adequate for this project, and can someone give me a little nudge about how I'd want to code this? I guess it'd need to run as a service?

    I'd appreciate any tips you guys might have for me.

  2. #2
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,194

    Re: Windows10 Monitor keyboard and mouse, send mail after inactivity

    If it's winforms then you can get the keypress or mousemove handlers to do what you want. Those are inside the form so it won't classify as an attempt to gather data,
    If it's a service then those events are not there and you need some other things, namely API calls.
    For mouse I can tell you that you can handle the GetCursorPos API Function and with a use of a timer you can check if the position have changed.
    For the keyboard I'm not gonna give something as capturing keystrokes seems suspicious and also not the best as a lot of mixture will go about with windows also getting key commands etc but what you can do is use the RegisterHotKey so you can have a couple of command keys that if pressed you can be notified that someone pressed them. See here: https://docs.microsoft.com/en-us/win...ectedfrom=MSDN

    Note that this might be a challenge if you never had to do API calls but you can post in the .net of vb6 forums and clearly state what you are trying, especially with keyboard , seen a persons first post is for grabbing the keys pressed, looks suspicious.
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  3. #3

    Thread Starter
    New Member
    Join Date
    Jun 2022
    Location
    Texas
    Posts
    2

    Re: Windows10 Monitor keyboard and mouse, send mail after inactivity

    Quote Originally Posted by sapator View Post
    If it's a service then those events are not there and you need some other things, namely API calls.
    For mouse I can tell you that you can handle the GetCursorPos API Function and with a use of a timer you can check if the position have changed.

    Note that this might be a challenge if you never had to do API calls but you can post in the .net of vb6 forums and clearly state what you are trying, especially with keyboard , seen a persons first post is for grabbing the keys pressed, looks suspicious.
    Thanks for that response, @sapator. The deal is, I'm an old guy and I live alone, and I want my family to be notified if something happens to me at home. I'm on the computer every day, so I figure monitoring user input could be an easy way to monitor my activity level, i.e. if I don't wiggle the mouse before noon, something might be wrong and the PC would then send one of my kids a "Check on dad" email, assuming a Windows service can do that.

    So now that you mention it, I don't really need to trap for keyboard input since mouse movement is also a valid indicator that I'm using the computer. I think the GetCursorPos API Function is probably where I need to start, and I'll ping the VB6 and/or .net boards when I need help. Thanks again for the tips!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width