Another SystemParametersInfo question

D

Dwight Trumbower

I need to disable the screen saver, due to an Excel "bug".

I thought I had the following code working, but now all I get is code 127.
I've searched the net and I don't see anything wrong with the following.


[DllImport("user32.dll", CharSet=CharSet.Auto, SetLastError=true)]
public static extern int SystemParametersInfo(int uiAction, int uiParam,
string pvParam, int fuWinIni);

static void Main()
{
const int SPI_SETSCREENSAVEACTIVE = 17;
int screenStatus;
int retCode = 0 ;
screenStatus = 0; // disable screen saver
retCode = SystemParametersInfo (SPI_SETSCREENSAVEACTIVE, 0, "0",0);
if (retCode == 0 )
retCode = Marshal.GetLastWin32Error ();
MessageBox.Show ("Screen saver not turned off","Screen Saver"); //Deactivate
screen saver
}

Thanks
Dwight
 
D

dkerwood

Dwight

I'm also having the same problem - did you find a solution to stop getting the 127 error?

Please let me know if you have a solution

Darre

User submitted from AEWNET (http://www.aewnet.com/)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top