MFC好久不用就會忘記,這次用到MessageBox才注意到裏面第一個參數。函數定義如下:
int MessageBox(
HWND hWnd,
LPCTSTR lpText,
LPCTSTR lpCaption,
UINT uType
);
Parameters
hWnd
[in] Handle to the owner window of the message box to be created. If this parameter is NULL, the message box has no owner window.
光看含義可能不是特別明白,網上搜了一下,加上自己調試,大致總結如下:
NULL默認爲桌面,此時彈出的消息框會與桌面上任何窗體平級,此時會在任務欄上新加一個窗口 。
如果設爲父窗口,則彈出的消息框第二個會在父窗體之上,任務欄中不會有新增窗口。