473,915 Members | 3,104 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Logged on desktop user?

GTi
Is there any way I can find out if there is any user logged on the
desktop from a service?

Jan 4 '06 #1
4 2129
GTi,

Yes, but you shouldn't do this. First, there might not be a logged in
user, and second, there may be multiple logged in users.

What you want to do is have your service expose a remoting endpoint, and
then have a program that runs in the client space which connects to the
service and passes/gets the appropriate information.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"GTi" <tu****@gmail.c om> wrote in message
news:11******** ************@g4 4g2000cwa.googl egroups.com...
Is there any way I can find out if there is any user logged on the
desktop from a service?

Jan 4 '06 #2
GTi

Nicholas Paldino [.NET/C# MVP] wrote:
GTi,

Yes, but you shouldn't do this. First, there might not be a logged in
user, and second, there may be multiple logged in users.

What you want to do is have your service expose a remoting endpoint, and
then have a program that runs in the client space which connects to the
service and passes/gets the appropriate information.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"GTi" <tu****@gmail.c om> wrote in message
news:11******** ************@g4 4g2000cwa.googl egroups.com...
Is there any way I can find out if there is any user logged on the
desktop from a service?


Nicholas,
Yeah - after walking round the blocks a while I ended with the same
conclusion.
Since my NT Service application is almost always depended on other
programs that only can run on the users desktop, I will change my
program to do the same as a icon by the clock.
(Note to me self: how do I do that?)

Jan 4 '06 #3
GTi wrote:
Yeah - after walking round the blocks a while I ended with the same
conclusion.
Since my NT Service application is almost always depended on other
programs that only can run on the users desktop, I will change my
program to do the same as a icon by the clock.
(Note to me self: how do I do that?)


If you do a google search for "system tray C#" you'll find lots of
hits, including
http://www.developer.com/net/csharp/article.php/3336751

Jon

Jan 4 '06 #4

"GTi" <tu****@gmail.c om> wrote in message
news:11******** ************@g4 4g2000cwa.googl egroups.com...
Is there any way I can find out if there is any user logged on the
desktop from a service?


Yep, using System.Manageme nt classes.

...

ManagementScope msc = new ManagementScope ("root\\cimv2") ;
// get the number of interactive logons (logontype = 2)
string queryString = "select LogonId from win32_logonsess ion where
logontype = 2";
using(Managemen tObjectSearcher query = new ManagementObjec tSearcher(msc,
new SelectQuery(que ryString)))
{
if (query.Get().Co unt == 0) // 0 = no interactive user logon
...
else
...
}

Willy.
Jan 4 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4579
by: RickPowell | last post by:
I wrote a VB .NET Service to restart the computer when certain business rules are triggered (such as not being rebooted in x days, no users logged on, time is 1-3 am, etc.). I am currently using a sloppy technique of checking the Registry to determine if and who is logged on. I would like to use a Microsoft sanctioned best-practice method of determining if anyone is logged on (and their Username and all Process Names that the User is...
0
364
by: gswitz | last post by:
I have written a Windows Service that watches a Lotus Notes InBox for emails, detaches attachments from the emails and attaches them to a different Lotus Notes Database. The service works properly until I log off of the server. At that point, this call begins returning nothing - not an error - just nothing... LnView_Mail = LnDb_Mail.GetView("($InBox)") Once this problem begins, logging back into the server does not resolve it.
0
4297
by: John Whitmer | last post by:
I am trying to put together a web page to show remote users which PC's are available for RDP so they can use. The page work's fine except for when the goes to the pc to pull the info on if anybody is logged in or not it seems to have trouble. here is the blurb from the temp file that gets created on the webserver. "Error opening Terminal server Computer-01 Error :Access is denied." The webserver Anon account is using a Domain account that...
2
2115
by: Vaj | last post by:
hi, i would be very thankful if u can help me in solving this problem. my problem is i 've a page in that i'm displaying the creation dates of all files. these dates are like server dates . now i've to display these creationdates in the current logged in user desktop timezone. thanks
1
1060
by: Philip Carnstam | last post by:
Hi, I know I've seen this thread around here somewhere before, but I can't seem to find it, so I'm asking the question anew. When trying to connect to my Terminal Server (Windows 2003) I get logged out before I have even seen the desktop. I log in and the dialog for personal settings shows up and is immidiately followed by "logging out" and "saving your settings".
40
3025
by: Jeff | last post by:
I have a system on a network and want to determine if anyone is currently connected to the back-end files. An interesting twist is that I have noticed that some users can be connected (have the front end open at the first form) and even though this links to the back-end files, there are no ldb files created. This is so I know when it is safe to compact the back-end files without going round to make sure everyone is logged off. User...
1
1133
by: Carl Woodward | last post by:
Dear all, I am writing an that performs automatic updates for one of our products. In order to ensure that the app can update \Program Files\Xxxx and SystemRoot\Drivers and use MoveFileEx to update in use files on reboot, we need to be running at Admin or Local System. So, we are planning to create a service to do this. ..NET makes the whole process very simple, but, how do we interact with the currently logged on user? Specifically,...
0
1480
by: nrworld | last post by:
Hi, I have a requirement to find the users logged in to a XP system using a C# service which is running as SYSTEM service. An additional requirement is to start an application on the Active Desktop users as that user. The application should be spawned by the service, is this possible if the user account is password protected and The service doesn't know the password of that user ?? Please help.
15
2715
by: paul814 | last post by:
Is it possible to display the logged in user that is accessing the form, in a textbox? so say I have txtname I want to display the username of the person that is logged in to the PC in that box, can I do this? How would this be done?
0
10038
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9880
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10922
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10541
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
8099
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5942
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4777
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4343
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3367
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.