📄 subject_18439.htm
字号:
<p>
序号:18439 发表者:Grant 发表日期:2002-10-21 01:38:45
<br>主题:怎样枚举在Taskbar上的窗口?
<br>内容:我试过EnumWindows,通过Get它的WindowStyle,但是不行。也想过用EnumThreadWindows,可是枚举不出系统的Process,更不用说ThreadWindow了。还有其他办法吗?
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
回复者:iwill 回复日期:2002-10-21 07:54:33
<br>内容://列出所有进程<BR>HANDLE snapshothandle=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);<BR>PROCESSENTRY32 processentry;<BR>processentry.dwSize=sizeof(PROCESSENTRY32);<BR>BOOL finded=Process32First(snapshothandle,&processentry);<BR>while(finded!=NULL)<BR>{<BR> //processentry中返回进程信息<BR> finded=Process32Next(snapshothandle,&processentry);<BR>}<BR>CloseHandle(snapshothandle);
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:徐景周 回复日期:2002-10-21 10:41:06
<br>内容:<BR>void CRegOCXDlg::OnShowdesktop() <BR>{<BR>// 寻找桌面上正运行的所有窗本,并将正显示的存储到数组pWnd[]中<BR>CWnd *pWnd[MAXNUM_RUNWINDOW], *pWndCur;<BR>int nWndNum = 0;<BR><BR> pWnd[nWndNum]= GetWindow(GW_HWNDFIRST);<BR> while (pWnd[nWndNum] != NULL)<BR> {<BR> pWndCur = pWnd[nWndNum];<BR> CString str;<BR> pWndCur->GetWindowText(str);<BR> if (pWndCur->IsWindowVisible() && ! pWndCur->IsIconic() &&! pWndCur->GetParent() &&pWndCur != this &&pWndCur != GetDesktopWindow() &&! str.IsEmpty() &&str != "Program Manager")<BR> {<BR> // 列表数中窗体数加一<BR> nWndNum++;<BR> // 为了安全起见,窗体数不应超过总窗体数!!<BR> nWndNum = min(nWndNum, MAXNUM_RUNWINDOW-1);<BR> }<BR> pWnd[nWndNum] = pWndCur->GetWindow(GW_HWNDNEXT);<BR> }<BR><BR> if (nWndNum)<BR> {<BR> // 将正在运行的所有桌面窗体最小化<BR> for (int i=0; i<nWndNum;++i)<BR> {<BR> pWnd[i]->ShowWindow(SW_SHOWMINNOACTIVE);<BR> m_pWnd[i] = pWnd[i];<BR> }<BR> m_nWndNum = nWndNum;<BR> }<BR> else<BR> {<BR> // 将已运行并被最小化的桌面窗体还原显示<BR> for (int i=m_nWndNum-1; i>=0; --i)<BR> {<BR> if (::IsWindow(m_pWnd[i]->m_hWnd) &&<BR> m_pWnd[i]->IsIconic())<BR> {<BR> m_pWnd[i]->ShowWindow(SW_RESTORE);<BR> m_pWnd[i]->UpdateWindow();<BR> }<BR> }<BR> }<BR> //将控件注册器的窗体提到最前<BR> SetForegroundWindow();<BR>}
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:徐景周 回复日期:2002-10-21 11:16:15
<br>内容:可参看下面:<BR><BR>http://www.copathway.com/cndevforum/subject_view.asp?subject_id=16544&forum_id=
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:Grant 回复日期:2002-10-21 17:35:46
<br>内容:谢谢两位,iwill,我不知道怎么才能把分数分给你, soryy!
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -