Click here to Skip to main content
15,912,897 members
Home / Discussions / C#
   

C#

 
GeneralRe: How do you protect your app hosting third party dll ...? Pin
Eddy Vluggen7-Mar-11 0:41
professionalEddy Vluggen7-Mar-11 0:41 
GeneralRe: How do you protect your app hosting third party dll ...? Pin
devvvy7-Mar-11 14:27
devvvy7-Mar-11 14:27 
QuestionUpdate progress bar on another form Pin
Etienne_1232-Mar-11 21:28
Etienne_1232-Mar-11 21:28 
AnswerRe: Update progress bar on another form Pin
musefan2-Mar-11 22:29
musefan2-Mar-11 22:29 
GeneralRe: Update progress bar on another form Pin
Etienne_1233-Mar-11 21:17
Etienne_1233-Mar-11 21:17 
AnswerRe: Update progress bar on another form Pin
DaveyM693-Mar-11 1:13
professionalDaveyM693-Mar-11 1:13 
GeneralRe: Update progress bar on another form Pin
Luc Pattyn3-Mar-11 1:36
sitebuilderLuc Pattyn3-Mar-11 1:36 
GeneralRe: Update progress bar on another form Pin
DaveyM693-Mar-11 3:58
professionalDaveyM693-Mar-11 3:58 
GeneralRe: Update progress bar on another form Pin
Etienne_1233-Mar-11 20:00
Etienne_1233-Mar-11 20:00 
QuestionPausing execution for certain amount of time without freezing the form. Pin
john1234512-Mar-11 14:48
john1234512-Mar-11 14:48 
AnswerRe: Pausing execution for certain amount of time without freezing the form. Pin
Luc Pattyn2-Mar-11 15:31
sitebuilderLuc Pattyn2-Mar-11 15:31 
AnswerRe: Pausing execution for certain amount of time without freezing the form. Pin
OriginalGriff2-Mar-11 21:19
mveOriginalGriff2-Mar-11 21:19 
GeneralRe: Pausing execution for certain amount of time without freezing the form. Pin
Luc Pattyn3-Mar-11 0:53
sitebuilderLuc Pattyn3-Mar-11 0:53 
AnswerRe: Pausing execution for certain amount of time without freezing the form. Pin
musefan2-Mar-11 22:20
musefan2-Mar-11 22:20 
QuestionConsole in c# 2008 Express Pin
Bob Pawley2-Mar-11 12:47
Bob Pawley2-Mar-11 12:47 
AnswerRe: Console in c# 2008 Express Pin
Dave Kreskowiak2-Mar-11 12:59
mveDave Kreskowiak2-Mar-11 12:59 
AnswerRe: Console in c# 2008 Express Pin
DaveyM692-Mar-11 13:32
professionalDaveyM692-Mar-11 13:32 
AnswerRe: Console in c# 2008 Express Pin
I Believe In GOD2-Mar-11 21:16
I Believe In GOD2-Mar-11 21:16 
QuestionHow to select a radio button in internet explorer. Pin
sososm2-Mar-11 11:46
sososm2-Mar-11 11:46 
QuestionLastinputinfo() not working on my machine ... Pin
turbosupramk32-Mar-11 10:51
turbosupramk32-Mar-11 10:51 
For some reason this will not work on my machine (Vista Enterprise sp2)

My messagebox display says "697538 seconds 697538 (this increments each time I run it but is always the same as the first number) seconds At second 0" .

When I run the second block of code it says "Last input ticks is 8 and idle ticks is 697791247 (this increments each time I run it) .

I got code example from this site, any idea as to why this won't work for me or what I am doing wrong? Thank you for reading.


http://www.geekpedia.com/tutorial210_Retrieving-the-Operating-System-Idle-Time-Uptime-and-Last-Input-Time.html[^]


public static void timerThread()
{
    int timerCount = 0;
    //int LastInputTicks = 0;
    //int IdleTicks = 0;
    while (true)
    {
        MessageBox.Show("Start counting");
        Thread.Sleep(10000);
        int systemUptime = Environment.TickCount;
        int LastInputTicks = 0;
        int IdleTicks = 0;
        LASTINPUTINFO LastInputInfo = new LASTINPUTINFO();
        LastInputInfo.cbSize = (uint)Marshal.SizeOf(LastInputInfo);
        LastInputInfo.dwTime = 0;
        LastInputTicks = (int)LastInputInfo.dwTime;
        IdleTicks = systemUptime - LastInputTicks;
        string one = Convert.ToString(systemUptime / 1000) + " seconds";
        string two = Convert.ToString(IdleTicks / 1000) + " seconds";
        string three = "At second " + Convert.ToString(LastInputTicks / 1000);
        MessageBox.Show(one + " " + two + " " + three);
        Thread.Sleep(60000);
    }

}




public static void timerThread()
{
    int timerCount = 0;
    int LastInputTicks = 0;
    int IdleTicks = 0;
    while (true)
    {
        MessageBox.Show("Start counting");
        Thread.Sleep(10000);
        int systemUptime = Environment.TickCount;
        LASTINPUTINFO lastInPut = new LASTINPUTINFO();
        lastInPut.dwTime = 0;
        lastInPut.cbSize = (uint)Marshal.SizeOf(lastInPut);
        lastInPut.dwTime = (uint)Marshal.SizeOf(lastInPut);
        LastInputTicks = (int)lastInPut.dwTime;
        IdleTicks = systemUptime - LastInputTicks;
        MessageBox.Show("Last input ticks is " + LastInputTicks.ToString() + " and idle ticks is " + IdleTicks.ToString());
        Thread.Sleep(60000);
    }

}

AnswerRe: Lastinputinfo() not working on my machine ... Pin
Eddy Vluggen2-Mar-11 11:08
professionalEddy Vluggen2-Mar-11 11:08 
AnswerRe: Lastinputinfo() not working on my machine ... [modified] Pin
DaveyM692-Mar-11 12:11
professionalDaveyM692-Mar-11 12:11 
GeneralRe: Lastinputinfo() not working on my machine ... Pin
turbosupramk33-Mar-11 6:08
turbosupramk33-Mar-11 6:08 
GeneralRe: Lastinputinfo() not working on my machine ... Pin
DaveyM693-Mar-11 6:58
professionalDaveyM693-Mar-11 6:58 
QuestionGetting the relevent letter for unicode. Pin
prasadbuddhika2-Mar-11 6:46
prasadbuddhika2-Mar-11 6:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.