Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
822 views
in Technique[技术] by (71.8m points)

windows - Disable X-Button Icon on the top of the right in Messagebox Using C++ Win32 API?

i am using C++ win32 API...

i have a Windows messagebox contain OKCANCEL Button...

the messagebox have a close(X-Button) on the right top...

retun1=MessageBox(hDlg,TEXT("Your password will expired,you must change the password"),TEXT("Logon Message"),MB_OK | MB_ICONINFORMATION);

i only want to close the messagebox using the CANCEL Button...

So,i want to disable the X-Button Icon...

i am already try MB_ICONMASK MB_MODEMASK Somethink like that.

But i cant get it,what i need...

How can i Resolve it?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

In your OnInitDialog, you can try:

CMenu* pSysMenu = GetSystemMenu(FALSE);

if (pSysMenu != NULL)
{
//disable the X
pSysMenu->EnableMenuItem (SC_CLOSE, MF_BYCOMMAND|MF_GRAYED);
} 

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...