Using SystemParametersInfo from C# (SPI_GETSCREENREADER SPI_SETSCREENREADER)

我的梦境 提交于 2019-12-04 17:12:39

The pinvoke declaration is completely wrong, it was copied from VB6 code. The return type and arguments are not long (the VB6 int32 type), they are int. Pinvoke.net is a decent site to get good declarations.

[DllImport("user32.dll", SetLastError = true)]
static extern bool SystemParametersInfo(int uiAction, int uiParam, IntPtr pvParam, int fWinIni);

Don't forget to throw Win32Exception when you get a false return so failure isn't silent.

Based on this article, the last parameter to SystemParametersInfo should be:

int SPIF_SENDCHANGE = 0x02;

When changing the value.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!