Pergunta

I have a CDialog based application. In the Visual Studio resource editor the properties for my dialog show the style is set to "Popup" and the System Menu value is "True". However when I run my application there is no system menu; how can I get a system menu to show? Do I need to set an icon first with SetIcon()?

Here is the definition of my dialog from the resource file:

IDD_MAIN_DIALOG DIALOGEX 0, 0, 637, 371
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE
| WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_CONTROLPARENT
Foi útil?

Solução

Apparently it seems you need an icon to display the system menu. I added an icon resource to my project and then called the following in my OnInitDialog() method:

SetIcon(AfxGetApp()->LoadIcon(IDI_APP_ICON), TRUE);

Now my app has an icon and when I left click on it, it shows the system menu.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top