473,394 Members | 1,797 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

VB.NET 2: GetAsyncKeyState on more than one desktop

5
Hi there,

for my "homework" I need to write an application that would log computer idleness to file. Idleness in my case is defined by keyboard inactivity for more than 10 minutes.

So I've created a service to run this system wide. In that service I've put timer and some basic logic.

Logic is really simple:
Expand|Select|Wrap|Line Numbers
  1. count = 0
  2. For i As Integer = 7 To Byte.MaxValue - 1
  3.     If GetAsyncKeyState(i) <> 0 Then count += 1
  4. Next i
  5.  
  6. if count > 0 then return true
  7.  
Logic is simple and service runs like a charm. Service is installed by installutils.exe with maximum permissions set.

So where is the problem?
One of my machines are in use by my whole family. It has three user accounts.

Problems begin when more than one user is logged in ... because GetAsyncKeyState returns status only for the user, that logged in first. I believe there are some multiple (currently in use) desktop issues but I just can't find a solution.


Can please anyone help me with how to 'switch' to currently active desktop from service so that GetAsyncKeyState would give me some results.

btw: I have the same problem with GetCursorPos logic ... it just returns x=0, y=0

I'm using win XP SP2 VB.NET2


Thank you for your help,
Damjan
Jan 22 '08 #1
0 2428

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: NotGiven | last post by:
I am researching the best place to put pictures. I have heard form both sides and I'd like to know why one is better than the other. Many thanks!
2
by: Jeremy Chapman | last post by:
Populating a typed dataset from xml document: I created an xml schema (attached below), generated a typed dataset from it, and then programatically I tried to populate the typed dataset by...
3
by: Elp | last post by:
Hi, I have developped a Windows applcation (in C#) that allows, among other things, users to view and control the desktop of a remote Windows XP Pro machine. I have actually simply embedded the...
5
by: TerryWilson | last post by:
I am developing a web based service tool using asp.net that we will distribute with our product. This service tool will be used for remotely configuring the product, problem determination, etc. ...
0
by: Pitaridis Aristotelis | last post by:
Hi, I used the GetAsyncKeyState API function Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Integer) As Short in order to check the state of a key I use the code below...
7
by: Sky | last post by:
I have been looking for a more powerful version of GetType(string) that will find the Type no matter what, and will work even if only supplied "{TypeName}", not the full "{TypeName},{AssemblyName}"...
15
by: Mephisto187 | last post by:
How can I find the currently visible desktop? By calling EnumWindowStations and EnumDesktops I get a list of all available desktops. But is there a way to figure out which one of them is currently...
6
by: =?Utf-8?B?Q3JhaWc=?= | last post by:
If I have an application that I send out to users, and the application interacts with the database (behind the scenes, no direct sql creation by the users)....do webservices make the app more...
0
by: pramod1221 | last post by:
hey everyone, i am using getasynckeystate along with a a timer in vb.net 2008 to capture certain keywords and perform an action, but the problem i am facing is the the words captured is not the same...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.