Originally posted by Rekd Thanks ullbergm. That works.
Question; I do VB6 programmin, where do you send the WM_SETTINGSCHANGE message? Can I do this with VB6? |
It's been a while since i did
VB.. I may take a look at it later on today, but here is the basic idea:
You need to call a windows api called SystemParametersInfo
BOOL SystemParametersInfo(
UINT uiAction,
UINT uiParam,
PVOID pvParam,
UINT fWinIni
);
I dont remember how to import external dll's in
vb right now but after you import it you call it with the following parameters:
Get the value:
uiAction = SPI_GETSNAPTODEFBUTTON (0x005F)
uiParam = 0
pvParam = reference to a integer
fWinIni = 0
if pvParam is 1 it's enabled, 0 disabled
Set the value:
uiAction = SPI_SETSNAPTODEFBUTTON (0x0060
uiParam = 1 or 0 (depending on if you want to enable or disable it)
pvParam = reference to a integer (may be able to set this to null, not sure, dont use it anyways..)
fWinIni = SPIF_SENDCHANGE (0x0002)
All i did was to read the previous value and set it to the opposite to toggle it.
Here is the c# code to give you some idea of what it looks like:
public static bool SnapToDefault
{
get
{
int bRetValue = 0;
SystemParametersInfo(
(uint)SPIActions.SPI_GETSNAPTODEFBUTTON,
0,
ref bRetValue,
0
);
return bRetValue == 1;
}
set
{
int bRetValue = 0;
int NewValue = (value ? 1 : 0);
SystemParametersInfo(
(uint)SPIActions.SPI_SETSNAPTODEFBUTTON,
(uint) NewValue,
ref bRetValue,
(uint)SPIWinINIFlags.SPIF_SENDCHANGE
);
}
} |