Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Oct 13th, 2004, 3:06 PM   #1
mici
Programmer
 
Join Date: Oct 2004
Posts: 67
Rep Power: 5 mici is on a distinguished road
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.
mici is offline   Reply With Quote
Old Oct 13th, 2004, 4:58 PM   #2
Pizentios
Programming Guru
 
Pizentios's Avatar
 
Join Date: May 2004
Location: Brandon, Manitoba, Canada
Posts: 2,023
Rep Power: 7 Pizentios is on a distinguished road
Send a message via ICQ to Pizentios Send a message via MSN to Pizentios
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!
Pizentios is offline   Reply With Quote
Old Oct 13th, 2004, 5:35 PM   #3
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,473
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
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."
Infinite Recursion is offline   Reply With Quote
Old Oct 14th, 2004, 11:21 AM   #4
mici
Programmer
 
Join Date: Oct 2004
Posts: 67
Rep Power: 5 mici is on a distinguished road
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.
mici is offline   Reply With Quote
Old Oct 14th, 2004, 11:35 AM   #5
Pizentios
Programming Guru
 
Pizentios's Avatar
 
Join Date: May 2004
Location: Brandon, Manitoba, Canada
Posts: 2,023
Rep Power: 7 Pizentios is on a distinguished road
Send a message via ICQ to Pizentios Send a message via MSN to Pizentios
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!
Pizentios is offline   Reply With Quote
Old Oct 14th, 2004, 1:01 PM   #6
mici
Programmer
 
Join Date: Oct 2004
Posts: 67
Rep Power: 5 mici is on a distinguished road
excellent.
__________________
coffee is my heroin.
mici is offline   Reply With Quote
Old Oct 14th, 2004, 2:32 PM   #7
Pizentios
Programming Guru
 
Pizentios's Avatar
 
Join Date: May 2004
Location: Brandon, Manitoba, Canada
Posts: 2,023
Rep Power: 7 Pizentios is on a distinguished road
Send a message via ICQ to Pizentios Send a message via MSN to Pizentios
I tak eit worked then??
__________________
Profanity is the one language that all programmers understand.

Check out my Blog <---updated Nov 30 2007!
Pizentios is offline   Reply With Quote
Old Oct 14th, 2004, 2:36 PM   #8
mici
Programmer
 
Join Date: Oct 2004
Posts: 67
Rep Power: 5 mici is on a distinguished road
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.
mici is offline   Reply With Quote
Old Oct 14th, 2004, 3:25 PM   #9
Pizentios
Programming Guru
 
Pizentios's Avatar
 
Join Date: May 2004
Location: Brandon, Manitoba, Canada
Posts: 2,023
Rep Power: 7 Pizentios is on a distinguished road
Send a message via ICQ to Pizentios Send a message via MSN to Pizentios
that's odd. I look for some answers around the net.
__________________
Profanity is the one language that all programmers understand.

Check out my Blog <---updated Nov 30 2007!
Pizentios is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:54 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC