Skip to content

Commit 1ab8df4

Browse files
authored
Merge pull request #1839 from mikeblome/mb-mfc
attempt to fix codesnippet issue
2 parents 8899752 + 0498d6c commit 1ab8df4

File tree

1 file changed

+30
-8
lines changed

1 file changed

+30
-8
lines changed

docs/mfc/example-displaying-a-dialog-box-via-a-menu-command.md

+30-8
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,16 @@ The procedures use the following names and values:
3737

3838
1. Add the following include statement to CDisplayDialogDoc.cpp (or CDisplayDialogApp.cpp) after the existing include statements:
3939

40-
[!code-cpp[NVC_MFCControlLadenDialog#42](../mfc/codesnippet/cpp/example-displaying-a-dialog-box-via-a-menu-command_1.cpp)]
40+
```cpp
41+
#include "TestDialog.h"
42+
```
4143

4244
1. Add the following code to `OnViewTest` to implement the function:
4345

44-
[!code-cpp[NVC_MFCControlLadenDialog#43](../mfc/codesnippet/cpp/example-displaying-a-dialog-box-via-a-menu-command_2.cpp)]
46+
```cpp
47+
CTestDialog testdlg;
48+
testdlg.DoModal();
49+
```
4550

4651
### To display a modeless dialog box
4752

@@ -51,29 +56,46 @@ The procedures use the following names and values:
5156

5257
- Declare the dialog box class preceding the first class declaration:
5358

54-
[!code-cpp[NVC_MFCControlLadenDialog#44](../mfc/codesnippet/cpp/example-displaying-a-dialog-box-via-a-menu-command_3.h)]
59+
```cpp
60+
class CTestDialog;
61+
```
5562

5663
- Declare a pointer to the dialog box after the Attributes public section:
5764

58-
[!code-cpp[NVC_MFCControlLadenDialog#45](../mfc/codesnippet/cpp/example-displaying-a-dialog-box-via-a-menu-command_4.h)]
65+
```cpp
66+
CTestDialog* m_pTestDlg;
67+
```
5968

6069
1. Edit DisplayDialogView.cpp:
6170

6271
- Add the following include statement after the existing include statements:
6372

64-
[!code-cpp[NVC_MFCControlLadenDialog#42](../mfc/codesnippet/cpp/example-displaying-a-dialog-box-via-a-menu-command_1.cpp)]
73+
```cpp
74+
#include "TestDialog.h"
75+
```
6576

6677
- Add the following code to the constructor:
6778

68-
[!code-cpp[NVC_MFCControlLadenDialog#46](../mfc/codesnippet/cpp/example-displaying-a-dialog-box-via-a-menu-command_5.cpp)]
79+
```cpp
80+
m_pTestDlg = NULL;
81+
```
6982

7083
- Add the following code to the destructor:
7184

72-
[!code-cpp[NVC_MFCControlLadenDialog#47](../mfc/codesnippet/cpp/example-displaying-a-dialog-box-via-a-menu-command_6.cpp)]
85+
```cpp
86+
delete m_pTestDlg;
87+
```
7388

7489
- Add the following code to `OnViewTest` to implement the function:
7590

76-
[!code-cpp[NVC_MFCControlLadenDialog#48](../mfc/codesnippet/cpp/example-displaying-a-dialog-box-via-a-menu-command_7.cpp)]
91+
```cpp
92+
if (NULL == m_pTestDlg)
93+
{
94+
m_pTestDlg = new CTestDialog(this);
95+
m_pTestDlg->Create(CTestDialog::IDD, this);
96+
}
97+
m_pTestDlg->ShowWindow(SW_SHOW);
98+
```
7799
78100
## See also
79101

0 commit comments

Comments
 (0)