Posts Tagged ‘SystemParametersInfo’


SystemParametersInfo is a powerful function which does and retrieves whole lot of things related to windows general behavior for eg: turning on and off certain features like mouse trails which we normally do via control panel->main.cpl

Look up MSDN for more information on SystemParametersInfo. I’ll just show a demo on how to turn on and off mouse trails…

// Turn on mouse trails, showing 10 cursors drawn in the trail
SystemParametersInfo( SPI_SETMOUSETRAILS, 10, 0, 0 );

// Turn off mouse trails, set trail count to 1 or zero to disable trails
SystemParametersInfo( SPI_SETMOUSETRAILS, 1, 0, 0 );

Applying registry changes without restarting explorer!

April 1, 2008 5 comments

You make some changes to windows registry but can’t see the effect on explorer? Well you’ve got to do some more housekeeping to get going, broadcast a setting changed message to all windows to let them know and to get explorer refreshed…

DWORD dwResult = 0;
SendMessageTimeout( HWND_BROADCAST, WM_SETTINGCHANGE, 0, 0, SMTO_ABORTIFHUNG, 100, &dwResult );

Lookup SystemParametersInfo to see if it’s already being done what you were trying to do!

Retrieve work area rectangle using SystemParametersInfo!

March 24, 2008 Leave a comment

Work area is that area of the screen excluding windows task bars and other custom application bars.

Simplest way to retrieve this area is to call SystemParametersInfo. Here is an e.g.

RECT rcWorkArea = { 0 };
SystemParametersInfo( SPI_GETWORKAREA, 0, &rcWorkArea, 0 );
AfxTrace( _T( "Work area: %d, %d, %d, %d" ), rcWorkArea.left,, rcWorkArea.right, rcWorkArea.bottom );

Limitation of this method is that this returns only the primary monitor work area information, to retrieve information pertaining to multiple monitors call GetMonitorInfo.

%d bloggers like this: