![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Oct 2004
Posts: 67
Rep Power: 5
![]() |
I'm writing a win32 app that occupies whole screen but doesn't switch to full screen, while runing app displays some graphical infos (graphs and stuff) wich were all coded using GDI functions.
Now whenever screensaver or monitors power saving features kick in i seem to loose grip on window handles and all drawings end up drawing with the 0,0 xy offset, as if all child windows have been moved there... even a listbox command starts drawing it's string items in the wrong place... looks realy strange and it's not related to the system since i've tried the app on several computers. Anyway does anyone have any idea why this is happening or how to stop it. If not, does anyone know how I could disable all of the power saving features while the program runs and then reenable them on exit. (oh god why do i keep complicating things, i should have writen it under linux)
__________________
coffee is my heroin. |
|
|
|
|
|
#2 |
|
Programming Guru
![]() ![]() |
why not just disable the power saving all together. Well, i guess if your worried about saving power maybe, but you really only need to do that on laptops. I would try looking for a registry value. Not sure where to start looking but, like everything else in windows power managment probally depends on the registry for it's settings. If your lucky a ini file, but i doubt that one.
__________________
Profanity is the one language that all programmers understand. Check out my Blog <---updated Nov 30 2007! |
|
|
|
|
|
#3 |
|
Programming Guru
![]() ![]() ![]() |
You can probably disable / enable power saving features under Win32 API.
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
|
|
#4 |
|
Programmer
Join Date: Oct 2004
Posts: 67
Rep Power: 5
![]() |
looked everywhere for the powersaving features and i couldn't find them... only part of win32 API that has some connection to power savings is the WM_SYSTEMCOMMAND message that sends info to all top level windows that the screen saver is about to engage, if you return FALSE on this the screen saver won't start... but unoftunatly there is no such message for the power saving.
Anyway i'm more interested in solving the problem of the incorrect display of GDI items then in disabling power features.... (tricky buisness if i attempt to remove power saving features thru the registry and the program crashes or for whatever reason it stops runing like power loss etc. the power settings won't be restored and i find that to be a serious flaw in the code...) If nothing i'd rather like to prevent theese features from engaging temporarily than disabling them entirely... (i wana doit the same way that video players use so the end result would allow user to watch the programm continously without having to move mouse every now and then); anyway tnx for the effort. ![]()
__________________
coffee is my heroin. |
|
|
|
|
|
#5 |
|
Programming Guru
![]() ![]() |
Hey,
I was reading a little bit on experts-excahnge. Found some code, but it might be outdated. Here it is: put this in your WndProc
case WM_SYSCOMMAND:
{
if((wParam&0xFFF0)==SC_SCREENSAVE || (wParam&0xFFF0) ==SC_MONITORPOWER)
{
return 0;
}
break;
}I have no idea if this will work, but it's worth try. I havn't tested it yet. Good Luck, i am going to keep looking into this matter.
__________________
Profanity is the one language that all programmers understand. Check out my Blog <---updated Nov 30 2007! |
|
|
|
|
|
#6 |
|
Programmer
Join Date: Oct 2004
Posts: 67
Rep Power: 5
![]() |
excellent.
__________________
coffee is my heroin. |
|
|
|
|
|
#7 |
|
Programming Guru
![]() ![]() |
I tak eit worked then??
__________________
Profanity is the one language that all programmers understand. Check out my Blog <---updated Nov 30 2007! |
|
|
|
|
|
#8 |
|
Programmer
Join Date: Oct 2004
Posts: 67
Rep Power: 5
![]() |
Well it did work on the level that it prevented screen saver an power savings to act, however i still have the problem of GDI elements displacement after a WM_SYSCOMMAND has been dispatched through the system...
It looks like all the window information variables have been set to 0 but they haven't. And i realy can't figure out why...
__________________
coffee is my heroin. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|