SPI_SETPOWEROFFACTIVE 
Author Message
 SPI_SETPOWEROFFACTIVE

Is there anybody use this system programming interface?  The code below
supposely turn the display monitor power off.
In VC++ 4.0, Win 95, I was using:

i=SystemParametersInfo(SPI_SETPOWEROFFTIMEOUT,1,NULL,0);     //returns
0, means fail
i=GetLastError();                                            //returns
183, means ALREADY_EXISTS
i=SystemParametersInfo(SPI_SETPOWEROFFACTIVE,1,NULL,0);      //returns
0, means fail
i=GetLastError();                                            //returns
183, means ALREADY_EXISTS

When I called Microsoft, a guy in Microsoft said that he got
INVALID_PLATFORM error code returned.  An hour later he called me and
said that he had found an article talked about this
SPI_SETPOWEROFFACTIVE param only works to 16-bit compiller.(!?)  
According to his sugestion, I tried to use VC++ 1.52, and found out
WINDOWS.H does not specify SPI_SETPOWEROFFACTIVE at all. Went back to
check on VC++ 4.0, WINUSER.H, I found #if(WINVER >= 0X400) for the
SPI_SETPOWEROFFACTIVE.  If I used a similar SPI_SETSCREENSAVEACTIVE
param, using VC++ 4.0, then it does work.

Funny things is that, Visual Basic has exactly same
SPI_SETPOWEROFFACTIVE param and works perfect!  Somebody said was
because 16-bit on VB.



Sat, 06 Nov 1999 03:00:00 GMT  
 SPI_SETPOWEROFFACTIVE

Every time I tried it from a Win32 executable, the error was 120:
ERROR_CALL_NOT_IMPLEMENTED.

The problem is that the implementation of the VESA/DPMS stuff is in the
16-bit USER.EXE, and the 32-bit USER32.DLL does not forward those calls,
as it does for most of the SPI_* values.

This will work:  Build a 16-bit Windows executable (e.g., with MSVC
1.52).  Put in your own #defines for SPI_SETPOWEROFFTIMEOUT, etc., using
the values in the MSVC 4.x header files.  Call SystemParametersInfo
using these values.

You can get there from a Win32 executable only by thunking.

Quote:

> Is there anybody use this system programming interface?  The code below
> supposely turn the display monitor power off.
> In VC++ 4.0, Win 95, I was using:

> i=SystemParametersInfo(SPI_SETPOWEROFFTIMEOUT,1,NULL,0);     //returns
> 0, means fail
> i=GetLastError();                                            //returns
> 183, means ALREADY_EXISTS
> i=SystemParametersInfo(SPI_SETPOWEROFFACTIVE,1,NULL,0);      //returns
> 0, means fail
> i=GetLastError();                                            //returns
> 183, means ALREADY_EXISTS

> When I called Microsoft, a guy in Microsoft said that he got
> INVALID_PLATFORM error code returned.  An hour later he called me and
> said that he had found an article talked about this
> SPI_SETPOWEROFFACTIVE param only works to 16-bit compiller.(!?)
> According to his sugestion, I tried to use VC++ 1.52, and found out
> WINDOWS.H does not specify SPI_SETPOWEROFFACTIVE at all. Went back to
> check on VC++ 4.0, WINUSER.H, I found #if(WINVER >= 0X400) for the
> SPI_SETPOWEROFFACTIVE.  If I used a similar SPI_SETSCREENSAVEACTIVE
> param, using VC++ 4.0, then it does work.

> Funny things is that, Visual Basic has exactly same
> SPI_SETPOWEROFFACTIVE param and works perfect!  Somebody said was
> because 16-bit on VB.

-- Aaron
---------------------
Aaron J Margosis

http://members.aol.com/aaronmarg/ssswitch/


Sun, 07 Nov 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 
 

 
Powered by phpBB® Forum Software