Centrafuse Carputer, CarPC & UMPC Forums
Go Back   Centrafuse Carputer, CarPC & UMPC Forums > 3rd Party Development > Miscellaneous Development

Miscellaneous Development All 3rd party development related to Centrafuse.

Reply
 
LinkBack Thread Tools Display Modes
Old June 11th, 2008, 10:36 AM   #1 (permalink)
10 Farad - Flux Capacity
malaki86's CarPC Specs
 
Join Date: May 2008
Posts: 471
malaki86 is on a distinguished road
Disable screensaver

I thought of something that might work as an easy way (hopefully) to disable the screensaver and/or the computers power scheme while Centrafuse is running.

What I was thinking is to use either the Sendkey function of Visual Basic, or use the SendInput Windows API. It could be set on a timer and send out an unused keystroke (such as Ctrl-Alt-Shift-Home) every so often. It may fool the screensaver/power scheme to think that the computer is actively being used.

If it could be made into a Plugin/DLL for CF, it would auto-run when CF starts, then it would also automatically end along with CF.

I'd love to try it right now just to see if it'd work, but I don't have VB on my laptop (that'll change this weekend). But, anyone think something like this would work?
__________________
My TruckPC setup (18 wheeler)


CFPlugins: LocalInfo
CFAddons: Updated XM Images
malaki86 is offline   Reply With Quote
Old June 11th, 2008, 12:02 PM   #2 (permalink)
10 Farad - Flux Capacity
nintwala's CarPC Specs
 
nintwala's Avatar
 
Join Date: Nov 2006
Location: RI, USA
Vehicle: 03 Accord EX
Posts: 1,133
nintwala will become famous soon enough
There is a way to set "Startup/Shutdown Commands" under General settings (Advanced Settings). If there is a command line that can be setup to set the power options or screen saver options, it can be made into a EXE (using AutoIT) or BAT file. One file can be launched at "Startup" and "Resume" to turn off the screensaver and power options, and another at "Sleep" and "Shutdown" to turn on.
__________________
~~~*~~~*~~~*~~~*~~~*~~~*~~~
Dont believe everything I say... I dont work for FluxMedia. Just helping out...

Modified Volume plugin - Please Vote

New Car2PC Plugin
- by Nerve

Aura BW Skin
- A twist to the Aura skin
nintwala is offline   Reply With Quote
Old June 11th, 2008, 12:11 PM   #3 (permalink)
10 Farad - Flux Capacity
malaki86's CarPC Specs
 
Join Date: May 2008
Posts: 471
malaki86 is on a distinguished road
I found this on a website and it sounds exactly like what I'm wanting:

Quote:
It seems that SendInput does something that SendKeys does not, and calls to it are detected by screen saver routines as mouse activity. Below is the VB6 source. Open a new project, drag a timer object to the form, and set the Timer1 to a 10 second fire (interval = 10000). What is convenient is that the actual routine doesn't need to move the mouse pointer at all. You just call with with a move amount of 0, so the event in injected into the mouse input stream, but no change occurs. Nice.
Code:
Option Explicit

Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (pDst As Any, pSrc As Any, ByVal ByteLen As Long)
Private Declare Function SendInput Lib "user32.dll" (ByVal nInputs As Long, pInputs As INPUT_TYPE, ByVal cbSize As Long) As Long

Private Const MOUSEEVENTF_MOVE = &H1
Private Const INPUT_MOUSE = 0

Private Type MOUSEINPUT
  dx As Long
  dy As Long
  mouseData As Long
  dwFlags As Long
  dwtime As Long
  dwExtraInfo As Long
End Type

Private Type INPUT_TYPE
  dwType As Long
  xi(0 To 23) As Byte
End Type

Private inputEvent(0) As INPUT_TYPE

Private Sub Form_Load()
   Dim mouseEvent As MOUSEINPUT
   
   ' Load up the event record
   mouseEvent.dx = 0
   mouseEvent.dy = 0
   mouseEvent.mouseData = 0
   mouseEvent.dwFlags = MOUSEEVENTF_MOVE
   mouseEvent.dwtime = 0
   mouseEvent.dwExtraInfo = 0
    
   ' Copy the record into the input array
   inputEvent(0).dwType = INPUT_MOUSE
   CopyMemory inputEvent(0).xi(0), mouseEvent, Len(mouseEvent)
    
End Sub

Private Sub Timer1_Timer()
    Dim intX As Integer
    
    intX = SendInput(1, inputEvent(0), Len(inputEvent(0)))
End Sub
__________________
My TruckPC setup (18 wheeler)


CFPlugins: LocalInfo
CFAddons: Updated XM Images
malaki86 is offline   Reply With Quote
Old June 11th, 2008, 10:55 PM   #4 (permalink)
10 Farad - Flux Capacity
 
Zerach's Avatar
 
Join Date: Oct 2005
Location: Vancouver, Canada
Posts: 257
Zerach is on a distinguished road
Quote:
Originally Posted by malaki86 View Post
I thought of something that might work as an easy way (hopefully) to disable the screensaver and/or the computers power scheme while Centrafuse is running.

What I was thinking is to use either the Sendkey function of Visual Basic, or use the SendInput Windows API. It could be set on a timer and send out an unused keystroke (such as Ctrl-Alt-Shift-Home) every so often. It may fool the screensaver/power scheme to think that the computer is actively being used.

If it could be made into a Plugin/DLL for CF, it would auto-run when CF starts, then it would also automatically end along with CF.

I'd love to try it right now just to see if it'd work, but I don't have VB on my laptop (that'll change this weekend). But, anyone think something like this would work?
why not just disable the screen saver and disable power scheme?

To Disable power scheme use

powercfg /setactive "Always On"

you can disable screen saver entirely using gpedit.msc or just through control panel...don't know if theirs a avable command line option. But a simple batch file should be enough.

Autoit is a great tool for screen scaping and sendkey operations but it's unreliable and can cause weird isssues if not scripted correctly, so script it correctly
__________________
Development Effort:
DSATX Plugin Release 1 [-------|] 100%
CentraSkin Editor V.60 [|------] 10%

update to V.55 compat with CF skins V1-2.01
Click here to get CentraSkin V.55
Send me PM for new CentraSkin feature requests
Zerach is offline   Reply With Quote
Old June 12th, 2008, 01:17 AM   #5 (permalink)
10 Farad - Flux Capacity
malaki86's CarPC Specs
 
Join Date: May 2008
Posts: 471
malaki86 is on a distinguished road
Nice - I never knew about the powercfg cmd line.

Here's what I did to make it easy now:

a) I created a batch file: monitor-power.bat
The file is:
@echo off
powercfg /change "speedswitch control" /monitor-timeout-ac %1

b) Centrafuse Startup command:
c:\program files\flux media\monitor-power 0

c) Centrafuse Shutdown command:
c:\program files\flux media\monitor-power 15

d) Set the screensaver to "None"

It now does exactly what I wanted. Thank you for the tip.
__________________
My TruckPC setup (18 wheeler)


CFPlugins: LocalInfo
CFAddons: Updated XM Images
malaki86 is offline   Reply With Quote
Old June 12th, 2008, 02:19 PM   #6 (permalink)
10 Farad - Flux Capacity
nintwala's CarPC Specs
 
nintwala's Avatar
 
Join Date: Nov 2006
Location: RI, USA
Vehicle: 03 Accord EX
Posts: 1,133
nintwala will become famous soon enough
good job malaki86.
__________________
~~~*~~~*~~~*~~~*~~~*~~~*~~~
Dont believe everything I say... I dont work for FluxMedia. Just helping out...

Modified Volume plugin - Please Vote

New Car2PC Plugin
- by Nerve

Aura BW Skin
- A twist to the Aura skin
nintwala is offline   Reply With Quote
Old June 19th, 2008, 04:26 PM   #7 (permalink)
10 Farad - Flux Capacity
 
Zerach's Avatar
 
Join Date: Oct 2005
Location: Vancouver, Canada
Posts: 257
Zerach is on a distinguished road
Quote:
Originally Posted by malaki86 View Post
Nice - I never knew about the powercfg cmd line.

Here's what I did to make it easy now:

a) I created a batch file: monitor-power.bat
The file is:
@echo off
powercfg /change "speedswitch control" /monitor-timeout-ac %1

b) Centrafuse Startup command:
c:\program files\flux media\monitor-power 0

c) Centrafuse Shutdown command:
c:\program files\flux media\monitor-power 15

d) Set the screensaver to "None"

It now does exactly what I wanted. Thank you for the tip.
Leave it to Microsoft to create a utility that does what we want but not tell us it's there. I found this out while at work, I do image creating for laptops and researched a few options, this one was the best and it's built in.

Nice work on the batch file I might just use this.

You are welcome.

Cheers,
__________________
Development Effort:
DSATX Plugin Release 1 [-------|] 100%
CentraSkin Editor V.60 [|------] 10%

update to V.55 compat with CF skins V1-2.01
Click here to get CentraSkin V.55
Send me PM for new CentraSkin feature requests
Zerach is offline   Reply With Quote
Old June 20th, 2008, 12:13 AM   #8 (permalink)
10 Farad - Flux Capacity
malaki86's CarPC Specs
 
Join Date: May 2008
Posts: 471
malaki86 is on a distinguished road
I've tweaked it a bit, plus found a small utility for changing the screensaver:

startup.bat
Code:
@echo off
powercfg /change "speedswitch control" /processor-throttle-ac adaptive
powercfg /change "speedswitch control" /monitor-timeout-ac 0
powercfg /change "speedswitch control" /standby-timeout-ac 0
setscrtimeout 72000
shutdown.bat
Code:
@echo off
powercfg /change "speedswitch control" /monitor-timeout-ac 5
powercfg /change "speedswitch control" /standby-timeout-ac 15
powercfg /change "speedswitch control" /processor-throttle-ac degrade
setscrtimeout 600
The "speedswitch control" is the name of the power scheme I use on my computer. You'll need to change that to whatever matches your system (eg. "Always on", "Desktop", etc).

The "/processor-throttle-ac degrade/adaptive" controls whether you want your computer to throttle down when CF isn't in use or not. This isn't required.

The "setscrtimeout" is the utility for changing the screensaver timer. It won't accept "0" (it changes it to 1 minute), so I put a huge timer for the screen saver while CF is running, knowing I won't go 10hrs without touching the screen. The number after it is in seconds, not minutes.

I've attached the 2 bat files plus the "setscrtimeout" utility. All 3 files need to be in the same directory to run properly (I put mine in the "program files/flux media" directory).
Attached Files
File Type: zip Disable_screensaver.zip (3.0 KB, 6 views)
__________________
My TruckPC setup (18 wheeler)


CFPlugins: LocalInfo
CFAddons: Updated XM Images
malaki86 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Screensaver request malaki86 Centrafuse Suggestions & Requests 5 May 22nd, 2008 11:07 AM
Disable Control iceboy Plugin Development 6 March 20th, 2008 04:28 AM
a screensaver Fresh Prince Centrafuse Suggestions & Requests 1 February 10th, 2008 05:31 AM
How to disable motiondetection? DJCannonball General Centrafuse Questions 12 January 10th, 2008 06:04 PM
Feature to disable unused features Anonymous Centrafuse Suggestions & Requests 1 August 5th, 2005 01:53 AM


All times are GMT -4. The time now is 11:39 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Advertisement System V2.5 By   Branden
©Copyright 2008 Flux Media, Inc. All rights reserved.