int CaaaaaaaApp::ExitInstance()
{
// TODO: Add your specialized code here and/or call the base class
// 卸載 GdiPlus
if (m_gdiplusToken)
Gdiplus::GdiplusShutdown(m_gdiplusToken);
return CWinApp::ExitInstance();
}
extern "C" long PASCAL EXPORT _stdcall nice(HDC hDC, long start, long end)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
// 此處為普通函式體
Graphics graphics(hDC);
int y = end;
for (int x = start; x <= end; x += 5)
{
graphics.DrawLine(&bluePen, start, y, x, start);
graphics.DrawLine(&redPen, end, x, y, end);
y -= 5;
}
return 0;
}
uj5u.com熱心網友回復:
nice() 函式中的 Graphics、Pen 都沒有釋放吧!
uj5u.com熱心網友回復:
C++離開作用域時會自動析構。
在VB中使用End陳述句強行結束程式。
uj5u.com熱心網友回復:
C++中Graphics和Pen沒有Dispose函式,不知道該怎么釋放
uj5u.com熱心網友回復:
是這樣用嗎?
Private Sub Command1_Click()
MoveToEx Me.hdc, 30, 30, P
LineTo Me.hdc, 150, 150
nice Picture1.hdc, 20, 300
End
End Sub