C语言中,如何使用GetWindowLong函数获取窗口句柄的样式?
- 内容介绍
- 文章标签
- 相关推荐
本文共计186个文字,预计阅读时间需要1分钟。
我使用GetWindowLong窗口API来获取C窗口的值。
我使用GetWindowLong窗口api来获取c#中窗口的当前窗口状态.[DllImport("user32.dll")] static extern int GetWindowLong(IntPtr hWnd, int nIndex); Process[] processList = Process.GetProcesses(); foreach (Process theprocess in processList) { long windowState = GetWindowLong(theprocess.MainWindowHandle, GWL_STYLE); MessageBox.Show(windowState.ToString()); }
我希望在www.autohotkey.com/docs/misc/Styles.htm上获得数字,但我得到的数字是-482344960,-1803550644和382554704.
我需要转换windowState变量吗?如果是的话,到底是什么?
这些价值观有什么奇怪之处?例如,482344960相当于0x1CC00000,它看起来像您可能期望看到的窗口样式.查看链接到的样式引用,即WS_VISIBLE | WS_CAPTION | 0xC000000.例如,如果您想测试WS_VISIBLE,您可以执行以下操作:
int result = GetWindowLong(theprocess.MainWindowHandle, GWL_STYLE); bool isVisible = ((result & WS_VISIBLE) != 0);
本文共计186个文字,预计阅读时间需要1分钟。
我使用GetWindowLong窗口API来获取C窗口的值。
我使用GetWindowLong窗口api来获取c#中窗口的当前窗口状态.[DllImport("user32.dll")] static extern int GetWindowLong(IntPtr hWnd, int nIndex); Process[] processList = Process.GetProcesses(); foreach (Process theprocess in processList) { long windowState = GetWindowLong(theprocess.MainWindowHandle, GWL_STYLE); MessageBox.Show(windowState.ToString()); }
我希望在www.autohotkey.com/docs/misc/Styles.htm上获得数字,但我得到的数字是-482344960,-1803550644和382554704.
我需要转换windowState变量吗?如果是的话,到底是什么?
这些价值观有什么奇怪之处?例如,482344960相当于0x1CC00000,它看起来像您可能期望看到的窗口样式.查看链接到的样式引用,即WS_VISIBLE | WS_CAPTION | 0xC000000.例如,如果您想测试WS_VISIBLE,您可以执行以下操作:
int result = GetWindowLong(theprocess.MainWindowHandle, GWL_STYLE); bool isVisible = ((result & WS_VISIBLE) != 0);

