不常用的Windows API及小功能收集中...
2011-07-10 21:10
197 查看
1. 判断当前OS默认的是单击还是双击
BOOL IsDoubleClickInWebView() { SHELLFLAGSTATE sfs; ZeroMemory(&sfs, sizeof(SHELLFLAGSTATE)); SHGetSettings(&sfs, SSF_DOUBLECLICKINWEBVIEW); return sfs.fDoubleClickInWebView != 0 ? TRUE : FALSE; }2. 获取当前桌面的窗口句柄
HWND FindShellWindow() { // Sometimes, we can't find the desktop window when we use this function, but we must // find it's handle, so we do a loop to find it, but at most we find for 10 times. UINT uFindCount = 0; HWND hSysListView32Wnd = NULL; while (NULL == hSysListView32Wnd && uFindCount < 10) { HWND hParentWnd = ::GetShellWindow(); HWND hSHELLDLL_DefViewWnd = ::FindWindowEx(hParentWnd, NULL, L"SHELLDLL_DefView", NULL); hSysListView32Wnd = ::FindWindowEx(hSHELLDLL_DefViewWnd, NULL, L"SysListView32", L"FolderView"); if (NULL == hSysListView32Wnd) { hParentWnd = ::FindWindowEx(NULL, NULL, L"WorkerW", L""); while((!hSHELLDLL_DefViewWnd) && hParentWnd) { hSHELLDLL_DefViewWnd = ::FindWindowEx(hParentWnd, NULL, L"SHELLDLL_DefView", NULL); hParentWnd = FindWindowEx(NULL, hParentWnd, L"WorkerW", L""); } hSysListView32Wnd = ::FindWindowEx(hSHELLDLL_DefViewWnd, 0, L"SysListView32", L"FolderView"); } if (NULL == hSysListView32Wnd) { Sleep(1000); uFindCount++; } else { break; } } return hSysListView32Wnd; }
相关文章推荐
- DevExpress 经典常用功能代码收集
- 告别windows使用Ubuntu Ubuntu下常用功能收集
- Winform常用的一些功能收集(持续更新)
- sublime Text 3实用功能和常用快捷键收集
- sublime Text 3实用功能和常用快捷键收集
- Winform常用的一些功能收集(持续更新)
- Javascript 常用功能收集-blogjava
- sublime Text 3实用功能和常用快捷键收集
- sublime Text 3实用功能和常用快捷键收集
- flex 常用功能代码收集
- php常用功能函数收集
- sublime Text 3实用功能和常用快捷键收集
- ios开发总结:Utils常用方法等收集,添加扩展类,工具类方法,拥有很多方便快捷功能(不断更新中。。。)
- .net开发中vs后台常用的功能实现代码收集
- Android 常用功能模块的一些Demo收集整理
- Sublime Text 3实用功能和常用快捷键收集
- DevExpress Grid控件经典常用功能代码收集
- Winform常用的一些功能收集(持续更新)
- Winform常用的一些功能收集(持续更新)
- [转]VC中常用文件功能函数收集