Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. implementation of "show me as idle for x mins"

implementation of "show me as idle for x mins"

Scheduled Pinned Locked Moved C#
tutoriallounge
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kamran Zafar
    wrote on last edited by
    #1

    Hi, Does anybody has any idea how to give implementation in c-sharp, of the following feature of Yahoo or MSN: Show me as "Away" when I am inactive for 10 minutes. I have a chat client application developed in c-sharp. And now I want to give the same feature in my app too. Prompt reply will be appreciated. Regards, Kamran

    S B 2 Replies Last reply
    0
    • K Kamran Zafar

      Hi, Does anybody has any idea how to give implementation in c-sharp, of the following feature of Yahoo or MSN: Show me as "Away" when I am inactive for 10 minutes. I have a chat client application developed in c-sharp. And now I want to give the same feature in my app too. Prompt reply will be appreciated. Regards, Kamran

      S Offline
      S Offline
      Stefan Troschuetz
      wrote on last edited by
      #2

      You could take a timestamp everytime the user of your application does something and store it somewhere. This timestamp value then gets compared with the actual time inside of an timer event handler and if the difference is greater than 10 min you set the status to "Away".


      www.troschuetz.de

      1 Reply Last reply
      0
      • K Kamran Zafar

        Hi, Does anybody has any idea how to give implementation in c-sharp, of the following feature of Yahoo or MSN: Show me as "Away" when I am inactive for 10 minutes. I have a chat client application developed in c-sharp. And now I want to give the same feature in my app too. Prompt reply will be appreciated. Regards, Kamran

        B Offline
        B Offline
        benjymous
        wrote on last edited by
        #3

        Simple solution - have a timer that ticks every so often (depending on how accurate you want your away timer to be) Every time the timer ticks, increment the counter, when the counter goes above a pre-set value (i.e. how ever many timer ticks there are in 10 minutes) you can set your status to away. Now, in any of your mouse/keyboard handlers, just reset that counter to zero if you've got user input -- Help me! I'm turning into a grapefruit! Phoenix Paint - back from DPaint's ashes!

        K 1 Reply Last reply
        0
        • B benjymous

          Simple solution - have a timer that ticks every so often (depending on how accurate you want your away timer to be) Every time the timer ticks, increment the counter, when the counter goes above a pre-set value (i.e. how ever many timer ticks there are in 10 minutes) you can set your status to away. Now, in any of your mouse/keyboard handlers, just reset that counter to zero if you've got user input -- Help me! I'm turning into a grapefruit! Phoenix Paint - back from DPaint's ashes!

          K Offline
          K Offline
          Kamran Zafar
          wrote on last edited by
          #4

          Hi Benjymouse, Thanks for your prompt reply. It helps me a lot to understand the solution. But how to capture mouse/keyboard events of windows. Remember my chat application application needs to be notified of any activity on windows for example if my chat application is minimized, and a user only moves his mouse on the desktop, my application should be able to capture this event. I hope you understand what i mean. Regards, Kamran dearkami@yahoo.com

          B 1 Reply Last reply
          0
          • K Kamran Zafar

            Hi Benjymouse, Thanks for your prompt reply. It helps me a lot to understand the solution. But how to capture mouse/keyboard events of windows. Remember my chat application application needs to be notified of any activity on windows for example if my chat application is minimized, and a user only moves his mouse on the desktop, my application should be able to capture this event. I hope you understand what i mean. Regards, Kamran dearkami@yahoo.com

            B Offline
            B Offline
            benjymous
            wrote on last edited by
            #5

            Yes, of course. Sorry - I didn't think that far. You'll need keyboard and mouse hooks, that'll let you monitor what's going on outside your application There's a few articles on how to do this here on Codeproject: Processing Global Mouse and Keyboard Hooks in C#[^] Global System Hooks in .NET[^] Using Hooks from C#[^] One of those should be able to get you going! -- Help me! I'm turning into a grapefruit! Phoenix Paint - back from DPaint's ashes!

            K 1 Reply Last reply
            0
            • B benjymous

              Yes, of course. Sorry - I didn't think that far. You'll need keyboard and mouse hooks, that'll let you monitor what's going on outside your application There's a few articles on how to do this here on Codeproject: Processing Global Mouse and Keyboard Hooks in C#[^] Global System Hooks in .NET[^] Using Hooks from C#[^] One of those should be able to get you going! -- Help me! I'm turning into a grapefruit! Phoenix Paint - back from DPaint's ashes!

              K Offline
              K Offline
              Kamran Zafar
              wrote on last edited by
              #6

              Thanks a lot Benjymous, I hope this will help me to resolve my problem. Thanks again! Best regards, Kamran

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups