How to detect whether user is on the desktop C# winforms












0















I was making a program that changes the desktop background, but there is no need to do this when the user is not on the desktop.



I was wondering if there was a way to detect if the user was on the desktop.



I was also thinking an alternative could be checking whether the user is on any other processes, but I don't know how to do this either.



(I would happily provide my code if necessary)



I'm sorry for posting such a broad question, I hope there is a way to do this though.



Thanks to anyone who can help!










share|improve this question

























  • You mean whether he is actually looking at the desktop background with no windows open? But still, say you are not looking at the desktop than why wouldn't you want to change the background so the next time he is staring at it he will see the new background? (wherever I write he , you may read she or it as well)

    – Peter Bons
    Dec 31 '18 at 8:29











  • i would like there to be a slideshow of backgrounds, a bit like windows already does. but only have the slideshow change when someone is actually looking at it. (hopefully this increases performance)

    – Simkoo
    Dec 31 '18 at 8:31






  • 2





    I should think the code that (continually) checks if someone is using the computer will have more negative impact on performance than the simple loading of the background image at intervals.

    – Johan Donne
    Dec 31 '18 at 8:38











  • Yeah, i guess that would be true, maybe this isn't the best situation to do this sort of a check. But is there even a way to check whether someone is on the desktop? if someone knows i would still love to know just for the sake of knowing. but maybe i'll reconsider doing this check in this script :)

    – Simkoo
    Dec 31 '18 at 8:43











  • Perhaps you find this interesting: stackoverflow.com/questions/203384/…

    – C.Evenhuis
    Dec 31 '18 at 8:44


















0















I was making a program that changes the desktop background, but there is no need to do this when the user is not on the desktop.



I was wondering if there was a way to detect if the user was on the desktop.



I was also thinking an alternative could be checking whether the user is on any other processes, but I don't know how to do this either.



(I would happily provide my code if necessary)



I'm sorry for posting such a broad question, I hope there is a way to do this though.



Thanks to anyone who can help!










share|improve this question

























  • You mean whether he is actually looking at the desktop background with no windows open? But still, say you are not looking at the desktop than why wouldn't you want to change the background so the next time he is staring at it he will see the new background? (wherever I write he , you may read she or it as well)

    – Peter Bons
    Dec 31 '18 at 8:29











  • i would like there to be a slideshow of backgrounds, a bit like windows already does. but only have the slideshow change when someone is actually looking at it. (hopefully this increases performance)

    – Simkoo
    Dec 31 '18 at 8:31






  • 2





    I should think the code that (continually) checks if someone is using the computer will have more negative impact on performance than the simple loading of the background image at intervals.

    – Johan Donne
    Dec 31 '18 at 8:38











  • Yeah, i guess that would be true, maybe this isn't the best situation to do this sort of a check. But is there even a way to check whether someone is on the desktop? if someone knows i would still love to know just for the sake of knowing. but maybe i'll reconsider doing this check in this script :)

    – Simkoo
    Dec 31 '18 at 8:43











  • Perhaps you find this interesting: stackoverflow.com/questions/203384/…

    – C.Evenhuis
    Dec 31 '18 at 8:44
















0












0








0








I was making a program that changes the desktop background, but there is no need to do this when the user is not on the desktop.



I was wondering if there was a way to detect if the user was on the desktop.



I was also thinking an alternative could be checking whether the user is on any other processes, but I don't know how to do this either.



(I would happily provide my code if necessary)



I'm sorry for posting such a broad question, I hope there is a way to do this though.



Thanks to anyone who can help!










share|improve this question
















I was making a program that changes the desktop background, but there is no need to do this when the user is not on the desktop.



I was wondering if there was a way to detect if the user was on the desktop.



I was also thinking an alternative could be checking whether the user is on any other processes, but I don't know how to do this either.



(I would happily provide my code if necessary)



I'm sorry for posting such a broad question, I hope there is a way to do this though.



Thanks to anyone who can help!







c# winforms






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 31 '18 at 8:33









marc_s

576k12811111258




576k12811111258










asked Dec 31 '18 at 8:24









SimkooSimkoo

297




297













  • You mean whether he is actually looking at the desktop background with no windows open? But still, say you are not looking at the desktop than why wouldn't you want to change the background so the next time he is staring at it he will see the new background? (wherever I write he , you may read she or it as well)

    – Peter Bons
    Dec 31 '18 at 8:29











  • i would like there to be a slideshow of backgrounds, a bit like windows already does. but only have the slideshow change when someone is actually looking at it. (hopefully this increases performance)

    – Simkoo
    Dec 31 '18 at 8:31






  • 2





    I should think the code that (continually) checks if someone is using the computer will have more negative impact on performance than the simple loading of the background image at intervals.

    – Johan Donne
    Dec 31 '18 at 8:38











  • Yeah, i guess that would be true, maybe this isn't the best situation to do this sort of a check. But is there even a way to check whether someone is on the desktop? if someone knows i would still love to know just for the sake of knowing. but maybe i'll reconsider doing this check in this script :)

    – Simkoo
    Dec 31 '18 at 8:43











  • Perhaps you find this interesting: stackoverflow.com/questions/203384/…

    – C.Evenhuis
    Dec 31 '18 at 8:44





















  • You mean whether he is actually looking at the desktop background with no windows open? But still, say you are not looking at the desktop than why wouldn't you want to change the background so the next time he is staring at it he will see the new background? (wherever I write he , you may read she or it as well)

    – Peter Bons
    Dec 31 '18 at 8:29











  • i would like there to be a slideshow of backgrounds, a bit like windows already does. but only have the slideshow change when someone is actually looking at it. (hopefully this increases performance)

    – Simkoo
    Dec 31 '18 at 8:31






  • 2





    I should think the code that (continually) checks if someone is using the computer will have more negative impact on performance than the simple loading of the background image at intervals.

    – Johan Donne
    Dec 31 '18 at 8:38











  • Yeah, i guess that would be true, maybe this isn't the best situation to do this sort of a check. But is there even a way to check whether someone is on the desktop? if someone knows i would still love to know just for the sake of knowing. but maybe i'll reconsider doing this check in this script :)

    – Simkoo
    Dec 31 '18 at 8:43











  • Perhaps you find this interesting: stackoverflow.com/questions/203384/…

    – C.Evenhuis
    Dec 31 '18 at 8:44



















You mean whether he is actually looking at the desktop background with no windows open? But still, say you are not looking at the desktop than why wouldn't you want to change the background so the next time he is staring at it he will see the new background? (wherever I write he , you may read she or it as well)

– Peter Bons
Dec 31 '18 at 8:29





You mean whether he is actually looking at the desktop background with no windows open? But still, say you are not looking at the desktop than why wouldn't you want to change the background so the next time he is staring at it he will see the new background? (wherever I write he , you may read she or it as well)

– Peter Bons
Dec 31 '18 at 8:29













i would like there to be a slideshow of backgrounds, a bit like windows already does. but only have the slideshow change when someone is actually looking at it. (hopefully this increases performance)

– Simkoo
Dec 31 '18 at 8:31





i would like there to be a slideshow of backgrounds, a bit like windows already does. but only have the slideshow change when someone is actually looking at it. (hopefully this increases performance)

– Simkoo
Dec 31 '18 at 8:31




2




2





I should think the code that (continually) checks if someone is using the computer will have more negative impact on performance than the simple loading of the background image at intervals.

– Johan Donne
Dec 31 '18 at 8:38





I should think the code that (continually) checks if someone is using the computer will have more negative impact on performance than the simple loading of the background image at intervals.

– Johan Donne
Dec 31 '18 at 8:38













Yeah, i guess that would be true, maybe this isn't the best situation to do this sort of a check. But is there even a way to check whether someone is on the desktop? if someone knows i would still love to know just for the sake of knowing. but maybe i'll reconsider doing this check in this script :)

– Simkoo
Dec 31 '18 at 8:43





Yeah, i guess that would be true, maybe this isn't the best situation to do this sort of a check. But is there even a way to check whether someone is on the desktop? if someone knows i would still love to know just for the sake of knowing. but maybe i'll reconsider doing this check in this script :)

– Simkoo
Dec 31 '18 at 8:43













Perhaps you find this interesting: stackoverflow.com/questions/203384/…

– C.Evenhuis
Dec 31 '18 at 8:44







Perhaps you find this interesting: stackoverflow.com/questions/203384/…

– C.Evenhuis
Dec 31 '18 at 8:44














1 Answer
1






active

oldest

votes


















1














If you want to check application in idle condition then you have to do below:
1) Add a timer control to your application.
2) Subscribe to mouseover and keydown events - when they fire, reset the timer.
3) When the timer fires (ie mouse hasn't moved and key's haven't been pressed for x amount of time), write your logic.



And If want to check idle condition of desktop then below references will be useful for you:
1): Detecting that the user is away from the PC with .NET
2): Detecting that the user is away from the PC with .NET
3) http://www.codeproject.com/KB/cs/ApplicationIdle.aspx
4) http://msdn.microsoft.com/en-us/library/system.windows.forms.application.idle.aspx
5)http://ellisweb.net/2008/02/detecting-application-idle-state-in-windows-forms/






share|improve this answer
























  • Thanks, this would be quite an effective way of solving the problem. It isn't quite the solution i was looking for, but thanks anyway!

    – Simkoo
    Dec 31 '18 at 8:49











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53985195%2fhow-to-detect-whether-user-is-on-the-desktop-c-sharp-winforms%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














If you want to check application in idle condition then you have to do below:
1) Add a timer control to your application.
2) Subscribe to mouseover and keydown events - when they fire, reset the timer.
3) When the timer fires (ie mouse hasn't moved and key's haven't been pressed for x amount of time), write your logic.



And If want to check idle condition of desktop then below references will be useful for you:
1): Detecting that the user is away from the PC with .NET
2): Detecting that the user is away from the PC with .NET
3) http://www.codeproject.com/KB/cs/ApplicationIdle.aspx
4) http://msdn.microsoft.com/en-us/library/system.windows.forms.application.idle.aspx
5)http://ellisweb.net/2008/02/detecting-application-idle-state-in-windows-forms/






share|improve this answer
























  • Thanks, this would be quite an effective way of solving the problem. It isn't quite the solution i was looking for, but thanks anyway!

    – Simkoo
    Dec 31 '18 at 8:49
















1














If you want to check application in idle condition then you have to do below:
1) Add a timer control to your application.
2) Subscribe to mouseover and keydown events - when they fire, reset the timer.
3) When the timer fires (ie mouse hasn't moved and key's haven't been pressed for x amount of time), write your logic.



And If want to check idle condition of desktop then below references will be useful for you:
1): Detecting that the user is away from the PC with .NET
2): Detecting that the user is away from the PC with .NET
3) http://www.codeproject.com/KB/cs/ApplicationIdle.aspx
4) http://msdn.microsoft.com/en-us/library/system.windows.forms.application.idle.aspx
5)http://ellisweb.net/2008/02/detecting-application-idle-state-in-windows-forms/






share|improve this answer
























  • Thanks, this would be quite an effective way of solving the problem. It isn't quite the solution i was looking for, but thanks anyway!

    – Simkoo
    Dec 31 '18 at 8:49














1












1








1







If you want to check application in idle condition then you have to do below:
1) Add a timer control to your application.
2) Subscribe to mouseover and keydown events - when they fire, reset the timer.
3) When the timer fires (ie mouse hasn't moved and key's haven't been pressed for x amount of time), write your logic.



And If want to check idle condition of desktop then below references will be useful for you:
1): Detecting that the user is away from the PC with .NET
2): Detecting that the user is away from the PC with .NET
3) http://www.codeproject.com/KB/cs/ApplicationIdle.aspx
4) http://msdn.microsoft.com/en-us/library/system.windows.forms.application.idle.aspx
5)http://ellisweb.net/2008/02/detecting-application-idle-state-in-windows-forms/






share|improve this answer













If you want to check application in idle condition then you have to do below:
1) Add a timer control to your application.
2) Subscribe to mouseover and keydown events - when they fire, reset the timer.
3) When the timer fires (ie mouse hasn't moved and key's haven't been pressed for x amount of time), write your logic.



And If want to check idle condition of desktop then below references will be useful for you:
1): Detecting that the user is away from the PC with .NET
2): Detecting that the user is away from the PC with .NET
3) http://www.codeproject.com/KB/cs/ApplicationIdle.aspx
4) http://msdn.microsoft.com/en-us/library/system.windows.forms.application.idle.aspx
5)http://ellisweb.net/2008/02/detecting-application-idle-state-in-windows-forms/







share|improve this answer












share|improve this answer



share|improve this answer










answered Dec 31 '18 at 8:45









S.ManeeshS.Maneesh

506




506













  • Thanks, this would be quite an effective way of solving the problem. It isn't quite the solution i was looking for, but thanks anyway!

    – Simkoo
    Dec 31 '18 at 8:49



















  • Thanks, this would be quite an effective way of solving the problem. It isn't quite the solution i was looking for, but thanks anyway!

    – Simkoo
    Dec 31 '18 at 8:49

















Thanks, this would be quite an effective way of solving the problem. It isn't quite the solution i was looking for, but thanks anyway!

– Simkoo
Dec 31 '18 at 8:49





Thanks, this would be quite an effective way of solving the problem. It isn't quite the solution i was looking for, but thanks anyway!

– Simkoo
Dec 31 '18 at 8:49


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53985195%2fhow-to-detect-whether-user-is-on-the-desktop-c-sharp-winforms%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Monofisismo

Angular Downloading a file using contenturl with Basic Authentication

Olmecas