Skip to content

Commit 18903df

Browse files
author
Colin Robertson
committed
Transfer some fixes from old markdig PR
1 parent 9728f3c commit 18903df

22 files changed

Lines changed: 729 additions & 675 deletions

docs/atl-mfc-shared/reference/cfixedstringt-class.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ explicit CFixedStringT(const unsigned char* psz);
9797

9898
```
9999
CFixedStringT<StringType, t_nChars>& operator=(
100-
const CFixedStringT<StringType, t_nChars>& str);
100+
const CFixedStringT<StringType, t_nChars>& str);
101101
CFixedStringT<StringType, t_nChars>& operator=(const char* psz);
102102
CFixedStringT<StringType, t_nChars>& operator=(const wchar_t* psz);
103103
CFixedStringT<StringType, t_nChars>& operator=(const unsigned char* psz);

docs/atl-mfc-shared/reference/cimage-class.md

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,13 @@ m_myImage.ReleaseDC();
126126
```cpp
127127
void CMyDlg::OnRButtonDown(UINT nFlags, CPoint point)
128128
{
129-
UNREFERENCED_PARAMETER(nFlags);
130-
131-
CBitmap* pBitmap = CBitmap::FromHandle(m_myImage);
132-
m_pmenuPop->AppendMenu(0, ID_BMPCOMMAND, pBitmap);
133-
ClientToScreen(&point);
134-
m_pmenuPop->TrackPopupMenu(TPM_RIGHTBUTTON | TPM_LEFTALIGN, point.x,
135-
point.y, this);
129+
UNREFERENCED_PARAMETER(nFlags);
130+
131+
CBitmap* pBitmap = CBitmap::FromHandle(m_myImage);
132+
m_pmenuPop->AppendMenu(0, ID_BMPCOMMAND, pBitmap);
133+
ClientToScreen(&point);
134+
m_pmenuPop->TrackPopupMenu(TPM_RIGHTBUTTON | TPM_LEFTALIGN, point.x,
135+
point.y, this);
136136
}
137137
```
138138

@@ -1196,9 +1196,9 @@ HRESULT Save(LPCTSTR pszFileName,
11961196
11971197
```
11981198
void SetColorTable(
1199-
UINT iFirstColor,
1200-
UINT nColors,
1201-
const RGBQUAD* prgbColors) throw();
1199+
UINT iFirstColor,
1200+
UINT nColors,
1201+
const RGBQUAD* prgbColors) throw();
12021202
```
12031203
12041204
### Parameters
@@ -1463,25 +1463,24 @@ BOOL TransparentBlt(
14631463
BOOL TransparentBlt(CImage* pSrcImage, CImage* pDstImage,
14641464
int xDest, int yDest, int nDestWidth, int nDestHeight)
14651465
{
1466-
HDC hDstDC = NULL;
1467-
BOOL bResult;
1468-
1469-
if(pSrcImage == NULL || pDstImage == NULL)
1470-
{
1471-
// Invalid parameter
1472-
return FALSE;
1473-
}
1466+
HDC hDstDC = NULL;
1467+
BOOL bResult;
14741468
1475-
// Obtain a DC to the destination image
1476-
hDstDC = pDstImage->GetDC();
1469+
if(pSrcImage == NULL || pDstImage == NULL)
1470+
{
1471+
// Invalid parameter
1472+
return FALSE;
1473+
}
14771474
1478-
// Perform the blit
1479-
bResult = pSrcImage->TransparentBlt(hDstDC, xDest, yDest, nDestWidth, nDestHeight);
1475+
// Obtain a DC to the destination image
1476+
hDstDC = pDstImage->GetDC();
1477+
// Perform the blit
1478+
bResult = pSrcImage->TransparentBlt(hDstDC, xDest, yDest, nDestWidth, nDestHeight);
14801479
1481-
// Release the destination DC
1482-
pDstImage->ReleaseDC();
1480+
// Release the destination DC
1481+
pDstImage->ReleaseDC();
14831482
1484-
return bResult;
1483+
return bResult;
14851484
}
14861485
```
14871486

docs/atl-mfc-shared/reference/crect-class.md

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -149,56 +149,56 @@ CPoint CenterPoint() const throw();
149149
A `CPoint` object that is the centerpoint of `CRect`.
150150
151151
### Example
152-
```cpp
152+
153+
```cpp
153154
// Code from this OnPaint() implementation can be pasted into your own application
154-
// to draw lines that would look like a letter "Y" within your dialog.
155+
// to draw lines that would look like a letter "Y" within your dialog.
155156
void CMyDlg::OnPaint()
156157
{
157-
CPaintDC dc(this);
158-
158+
CPaintDC dc(this);
159159
160-
// device context for painting
160+
// device context for painting
161161
162-
// get the size and position of the client area of
163-
// your window
162+
// get the size and position of the client area of
163+
// your window
164164
165-
CRect rect;
166-
GetClientRect(&rect);
165+
CRect rect;
166+
GetClientRect(&rect);
167167
168-
// Move the current pen to the top left of the window. We call the
169-
// TopLeft() member of CRect here and it returns a CPoint object we
170-
// pass to the override of CDC::MoveTo() that accepts a CPoint.
168+
// Move the current pen to the top left of the window. We call the
169+
// TopLeft() member of CRect here and it returns a CPoint object we
170+
// pass to the override of CDC::MoveTo() that accepts a CPoint.
171171
172-
dc.MoveTo(rect.TopLeft());
172+
dc.MoveTo(rect.TopLeft());
173173
174-
// Draw a line from the top left to the center of the window.
175-
// CenterPoint() gives us the middle point of the window as a
176-
// CPoint, and since CDC::LineTo() has an override that accepts a
177-
// CPoint, we can just pass it along.
174+
// Draw a line from the top left to the center of the window.
175+
// CenterPoint() gives us the middle point of the window as a
176+
// CPoint, and since CDC::LineTo() has an override that accepts a
177+
// CPoint, we can just pass it along.
178178
179-
dc.LineTo(rect.CenterPoint());
179+
dc.LineTo(rect.CenterPoint());
180180
181-
// Now, draw a line to the top right of the window. There's no
182-
// CRect member which returns a CPoint for the top right of the
183-
// window, so we'll reference the CPoint members directly and call
184-
// the CDC::LineTo() override which takes two integers.
181+
// Now, draw a line to the top right of the window. There's no
182+
// CRect member which returns a CPoint for the top right of the
183+
// window, so we'll reference the CPoint members directly and call
184+
// the CDC::LineTo() override which takes two integers.
185185
186-
dc.LineTo(rect.right, rect.top);
186+
dc.LineTo(rect.right, rect.top);
187187
188-
// The top part of the "Y" is drawn. Now, we'll draw the stem. We
189-
// start from the center point.
188+
// The top part of the "Y" is drawn. Now, we'll draw the stem. We
189+
// start from the center point.
190190
191-
dc.MoveTo(rect.CenterPoint());
191+
dc.MoveTo(rect.CenterPoint());
192192
193-
// and then draw to the middle of the bottom edge of the window.
194-
// We'll get the x-coordinate from the x member of the CPOINT
195-
// returned by CenterPoint(), and the y value comes directly from
196-
// the rect.
193+
// and then draw to the middle of the bottom edge of the window.
194+
// We'll get the x-coordinate from the x member of the CPOINT
195+
// returned by CenterPoint(), and the y value comes directly from
196+
// the rect.
197197
198-
dc.LineTo(rect.CenterPoint().x, rect.bottom);
198+
dc.LineTo(rect.CenterPoint().x, rect.bottom);
199199
}
200200
```
201-
201+
202202
## <a name="copyrect"></a> CRect::CopyRect
203203
Copies the `lpSrcRect` rectangle into `CRect`.
204204

docs/atl-mfc-shared/reference/csimplestringt-class.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,14 @@ void AppendChar(XCHAR ch);
147147
Copies a character or characters to a `CSimpleStringT` object.
148148
149149
### Syntax
150-
151-
```
150+
151+
```
152152
static void CopyChars(
153-
XCHAR* pchDest,
154-
const XCHAR* pchSrc,
155-
int nChars) throw();
156-
```
153+
XCHAR* pchDest,
154+
const XCHAR* pchSrc,
155+
int nChars) throw();
156+
```
157+
157158
#### Parameters
158159
*pchDest*
159160
A pointer to a character string.
@@ -182,13 +183,14 @@ _tprintf_s(_T("%s\n"), str);
182183
Copies a character or characters to a `CSimpleStringT` object.
183184

184185
### Syntax
185-
186-
```
186+
187+
```
187188
static void CopyCharsOverlapped(
188-
XCHAR* pchDest,
189-
const XCHAR* pchSrc,
190-
int nChars) throw();
191-
```
189+
XCHAR* pchDest,
190+
const XCHAR* pchSrc,
191+
int nChars) throw();
192+
```
193+
192194
#### Parameters
193195
*pchDest*
194196
A pointer to a character string.
@@ -815,7 +817,7 @@ CSimpleString s(_T("abc"), pMgr);
815817
LPTSTR p = s.GetBuffer(bufferSize);
816818
_tcscpy_s(p, bufferSize, _T("abc"));
817819

818-
// use the buffer directly
820+
// use the buffer directly
819821
ASSERT(s.GetLength() == 3);
820822

821823
// String length = 3

docs/atl/putting-the-control-on-a-web-page-atl-tutorial-part-7.md

Lines changed: 62 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -11,63 +11,67 @@ ms.author: "mblome"
1111
ms.workload: ["cplusplus"]
1212
---
1313
# Putting the Control on a Web Page (ATL Tutorial, Part 7)
14-
Your control is now finished. To see your control work in a real-world situation, put it on a Web page. An HTML file that contains the control was created when you defined your control. Open the PolyCtl.htm file from **Solution Explorer**, and you can see your control on a Web page.
15-
16-
In this step, you will script the Web page to respond to events. You will also modify the control to let Internet Explorer know that the control is safe for scripting.
17-
18-
## Scripting the Web Page
19-
The control does not do anything yet, so change the Web page to respond to the events that you send.
20-
21-
#### To script the Web page
22-
23-
1. Open PolyCtl.htm and select HTML view. Add the following lines to the HTML code. They should be added after `</OBJECT>` but before `</BODY>`.
24-
25-
```
26-
27-
<SCRIPT LANGUAGE="VBScript">
28-
<!--
29-
Sub PolyCtl_ClickIn(x, y)
30-
PolyCtl.Sides = PolyCtl.Sides + 1
31-
End Sub
32-
Sub PolyCtl_ClickOut(x, y)
33-
PolyCtl.Sides = PolyCtl.Sides - 1
34-
End Sub
35-
-->
36-
</SCRIPT>
37-
```
38-
39-
2. Save the HTM file.
40-
41-
You have added some VBScript code that gets the Sides property from the control and increases the number of sides by one if you click inside the control. If you click outside the control, you reduce the number of sides by one.
42-
43-
## Indicating that the Control Is Safe for Scripting
44-
You can view the Web page with the control in Internet Explorer or, more conveniently, use the Web browser view built into Visual C++. To see your control in the Web browser view, right-click PolyCtl.htm, and click **View in Browser**.
45-
46-
Based on your current Internet Explorer security settings, you may receive a Security Alert dialog box stating that the control may not be safe to script and could potentially do damage. For example, if you had a control that displayed a file but also had a `Delete` method that deleted a file, it would be safe if you just viewed it on a page. It would be not safe to script, however, because someone could call the `Delete` method.
47-
14+
15+
Your control is now finished. To see your control work in a real-world situation, put it on a Web page. An HTML file that contains the control was created when you defined your control. Open the PolyCtl.htm file from **Solution Explorer**, and you can see your control on a Web page.
16+
17+
In this step, you will script the Web page to respond to events. You will also modify the control to let Internet Explorer know that the control is safe for scripting.
18+
19+
## Scripting the Web Page
20+
21+
The control does not do anything yet, so change the Web page to respond to the events that you send.
22+
23+
#### To script the Web page
24+
25+
1. Open PolyCtl.htm and select HTML view. Add the following lines to the HTML code. They should be added after `</OBJECT>` but before `</BODY>`.
26+
27+
```html
28+
<SCRIPT LANGUAGE="VBScript">
29+
<!--
30+
Sub PolyCtl_ClickIn(x, y)
31+
PolyCtl.Sides = PolyCtl.Sides + 1
32+
End Sub
33+
Sub PolyCtl_ClickOut(x, y)
34+
PolyCtl.Sides = PolyCtl.Sides - 1
35+
End Sub
36+
-->
37+
</SCRIPT>
38+
```
39+
40+
2. Save the HTM file.
41+
42+
You have added some VBScript code that gets the Sides property from the control and increases the number of sides by one if you click inside the control. If you click outside the control, you reduce the number of sides by one.
43+
44+
## Indicating that the Control Is Safe for Scripting
45+
46+
You can view the Web page with the control in Internet Explorer or, more conveniently, use the Web browser view built into Visual C++. To see your control in the Web browser view, right-click PolyCtl.htm, and click **View in Browser**.
47+
48+
Based on your current Internet Explorer security settings, you may receive a Security Alert dialog box stating that the control may not be safe to script and could potentially do damage. For example, if you had a control that displayed a file but also had a `Delete` method that deleted a file, it would be safe if you just viewed it on a page. It would be not safe to script, however, because someone could call the `Delete` method.
49+
4850
> [!IMPORTANT]
49-
> For this tutorial, you can change your security settings in Internet Explorer to run ActiveX controls that are not marked as safe. In Control Panel, click **Internet Properties** and click **Security** to change the appropriate settings. When you have completed the tutorial, change your security settings back to their original state.
50-
51-
You can programmatically alert Internet Explorer that it does not need to display the Security Alert dialog box for this particular control. You can do this with the `IObjectSafety` interface, and ATL supplies an implementation of this interface in the class [IObjectSafetyImpl](../atl/reference/iobjectsafetyimpl-class.md). To add the interface to your control, add `IObjectSafetyImpl` to your list of inherited classes and add an entry for it in your COM map.
52-
53-
#### To add IObjectSafetyImpl to the control
54-
55-
1. Add the following line to the end of the list of inherited classes in PolyCtl.h and add a comma to the previous line:
56-
57-
[!code-cpp[NVC_ATL_Windowing#62](../atl/codesnippet/cpp/putting-the-control-on-a-web-page-atl-tutorial-part-7_1.h)]
58-
59-
2. Add the following line to the COM map in PolyCtl.h:
60-
61-
[!code-cpp[NVC_ATL_Windowing#63](../atl/codesnippet/cpp/putting-the-control-on-a-web-page-atl-tutorial-part-7_2.h)]
62-
63-
## Building and Testing the Control
64-
Build the control. Once the build has finished, open PolyCtl.htm in browser view again. This time, the Web page should be displayed directly without the Safety Alert dialog box. Click inside the polygon; the number of sides increases by one. Click outside the polygon to reduce the number of sides. If you try to reduce the number of sides below three, you will see the error message that you set.
65-
66-
[Back to Step 6](../atl/adding-a-property-page-atl-tutorial-part-6.md)
67-
68-
## Next Steps
69-
This concludes the ATL tutorial. For links to more information about ATL, see the [ATL start page](../atl/active-template-library-atl-concepts.md).
70-
71-
## See Also
72-
[Tutorial](../atl/active-template-library-atl-tutorial.md)
51+
> For this tutorial, you can change your security settings in Internet Explorer to run ActiveX controls that are not marked as safe. In Control Panel, click **Internet Properties** and click **Security** to change the appropriate settings. When you have completed the tutorial, change your security settings back to their original state.
52+
53+
You can programmatically alert Internet Explorer that it does not need to display the Security Alert dialog box for this particular control. You can do this with the `IObjectSafety` interface, and ATL supplies an implementation of this interface in the class [IObjectSafetyImpl](../atl/reference/iobjectsafetyimpl-class.md). To add the interface to your control, add `IObjectSafetyImpl` to your list of inherited classes and add an entry for it in your COM map.
54+
55+
#### To add IObjectSafetyImpl to the control
56+
57+
1. Add the following line to the end of the list of inherited classes in PolyCtl.h and add a comma to the previous line:
58+
59+
[!code-cpp[NVC_ATL_Windowing#62](../atl/codesnippet/cpp/putting-the-control-on-a-web-page-atl-tutorial-part-7_1.h)]
60+
61+
2. Add the following line to the COM map in PolyCtl.h:
62+
63+
[!code-cpp[NVC_ATL_Windowing#63](../atl/codesnippet/cpp/putting-the-control-on-a-web-page-atl-tutorial-part-7_2.h)]
64+
65+
## Building and Testing the Control
66+
67+
Build the control. Once the build has finished, open PolyCtl.htm in browser view again. This time, the Web page should be displayed directly without the Safety Alert dialog box. Click inside the polygon; the number of sides increases by one. Click outside the polygon to reduce the number of sides. If you try to reduce the number of sides below three, you will see the error message that you set.
68+
69+
[Back to Step 6](../atl/adding-a-property-page-atl-tutorial-part-6.md)
70+
71+
## Next Steps
72+
73+
This concludes the ATL tutorial. For links to more information about ATL, see the [ATL start page](../atl/active-template-library-atl-concepts.md).
74+
75+
## See Also
7376

77+
[Tutorial](../atl/active-template-library-atl-tutorial.md)

0 commit comments

Comments
 (0)