[問題] 獲取視窗Show/Hide狀態

看板C_and_CPP (C/C++)作者 (Kubrick)時間13年前 (2013/03/04 11:55), 編輯推噓0(002)
留言2則, 1人參與, 最新討論串1/1
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) VC6 MFC 問題(Question): 先Create出一個視窗, 之後進行某些操作時會需要得知此視窗是正在顯示(SW_SHOW), 或者已被使用者關閉(SW_HIDE), 要分辨這兩種情形來對應到不同的動作。 謝謝~ ------------------------------------ 試過j大提的函式, TestDialogSH* ptr = new TestDialogSH; ptr->Create(IDD_DIALOG_SH); WINDOWPLACEMENT WinPlace; CString str; ptr->GetWindowPlacement(&WinPlace); str.Format("%d",WinPlace.showCmd); AfxMessageBox(str); ptr->ShowWindow(SW_SHOW); ptr->GetWindowPlacement(&WinPlace); str.Format("%d",WinPlace.showCmd); AfxMessageBox(str); ptr->ShowWindow(SW_HIDE); ptr->GetWindowPlacement(&WinPlace); str.Format("%d",WinPlace.showCmd); AfxMessageBox(str); 然而三次Afx跳出來都是1... 我有查找一下,在Platform SDK裡面定義的GetWindowPlacement是這樣寫的: The flags member of WINDOWPLACEMENT retrieved by this function is always zero. If the window identified by the hWnd parameter is maximized, the showCmd member is SW_SHOWMAXIMIZED. If the window is minimized, showCmd is SW_SHOWMINIMIZED. Otherwise, it is SW_SHOWNORMAL. 照他這樣寫是只有三種值, 還是我不知道Call到哪去了?? 有請大神開示.. -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.34.227.117 ※ 編輯: PTTSuck 來自: 114.34.227.117 (03/04 11:55)

03/04 12:01, , 1F
GetWindowPlacement
03/04 12:01, 1F
※ 編輯: PTTSuck 來自: 114.34.227.117 (03/04 15:46)

03/04 16:48, , 2F
不然用IsWindowVisable試試
03/04 16:48, 2F
文章代碼(AID): #1HD1iPnN (C_and_CPP)
文章代碼(AID): #1HD1iPnN (C_and_CPP)