|
![]() |
|
|||||||
| Miscellaneous Development All 3rd party development related to Centrafuse. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
10 Farad - Flux Capacity
Join Date: May 2008
Posts: 471
![]() |
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? |
|
|
|
|
|
#2 (permalink) |
|
10 Farad - Flux Capacity
Join Date: Nov 2006
Location: RI, USA
Vehicle: 03 Accord EX
Posts: 1,133
![]() |
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 |
|
|
|
|
|
#3 (permalink) | |
|
10 Farad - Flux Capacity
Join Date: May 2008
Posts: 471
![]() |
I found this on a website and it sounds exactly like what I'm wanting:
Quote:
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
|
|
|
|
|
|
|
#4 (permalink) | |
|
10 Farad - Flux Capacity
Join Date: Oct 2005
Location: Vancouver, Canada
Posts: 257
![]() |
Quote:
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 |
|
|
|
|
|
|
#5 (permalink) |
|
10 Farad - Flux Capacity
Join Date: May 2008
Posts: 471
![]() |
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. |
|
|
|
|
|
#6 (permalink) |
|
10 Farad - Flux Capacity
Join Date: Nov 2006
Location: RI, USA
Vehicle: 03 Accord EX
Posts: 1,133
![]() |
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 |
|
|
|
|
|
#7 (permalink) | |
|
10 Farad - Flux Capacity
Join Date: Oct 2005
Location: Vancouver, Canada
Posts: 257
![]() |
Quote:
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 |
|
|
|
|
|
|
#8 (permalink) |
|
10 Farad - Flux Capacity
Join Date: May 2008
Posts: 471
![]() |
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 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 "/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). |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
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 |