MessageBox is a commonly used message prompt box. msdn defines it as follows:
Int MessageBox (hwndHwnd, LpctstrLptext, LpctstrLpcaption, UintUtype);
Generally, when using MFC, you can only write the prompt content MessageBox ("message prompt! ");
Or write two parameters and the title or three add-type buttons.
What I want to say is that when you write another VC header file and implementation file and call it in the MFC project, the first parameter must be written, otherwise Vs will fail.
But you may have to call multiple windows. Is that a problem?
This can be selected based on the current window. Use global: Afxgetapp ()-> getmainwnd ()-> getsafehwnd ()
Get the current window and prompt
At this time, the four parameters MessageBox (: Afxgetapp ()-> getmainwnd ()-> getsafehwnd (), "prompt content", "title", "type");
2. Use cfiledialog and then use fopen to return null.
The file to be opened is placed in the current path and can be called directly. No problem. When the file in another directory is selected in the open file dialog box, null is returned when the file is opened with fopen.
I initially thought that the file operations of MFC and C cannot be used together. I think it's wrong. After many experiments, it still doesn't work. Sometimes the success may fail. A colleague suggested that the file path should be incorrect when fopen fails to be opened,
I changed it to an absolute path and found it. I thought the reason should be that after selecting a file with cfiledialog, I changed the default path of the project. The path to fopen is incorrect, the specified file cannot be found.