let screen on during work

  • Thread starter Thread starter nicolas.lelievre
  • Start date Start date
N

nicolas.lelievre

Hi,

I would like to let always the screen on so I was trying using the
fonction : SystemIdleTimerReset but it's seems to not work on my
device.
I have tried to put SystemIdleTimerReset() everywhere into my code but
the screen is turning off either.
It's C# code.
This is how I import the DLL :

* My code sample :


[DllImport("coredll.dll")]
static extern void SystemIdleTimerReset();

Do you know if I'm doing something wrong or if I can find another way
to do it.
The other thing is that I don't want to touch to the registry keys.

Thank you for your help.
 
Putting the code "everywhere" isn't useful. You have to call it
periodically - the period must be less than the system timeout period.

-Chris
 
Yes of course it's not useful but what I mean it's even if I put it
everywhere it doesn's seems to work as expected....
 
Are you calling it periodically in a time interval less than the timeout?
If not it won't work. Period.

-Chris
 
Yes, but I find my error, this is how I need to write it :

[DllImport("coredll.dll", EntryPoint = "SystemIdleTimerReset")]
public static extern void SystemIdleTimerReset();

now it works...

Thanks !
 
There's no difference between this and the original other than it's marked
public. The EntryPoint meta is useful when you want to alias. If it's the
same as your declared function it has no effect.

-Chris
 
Back
Top