wxDebugMsg("wxDC::SetFont: Selecting HFONT %X\n", m_font.GetResourceHandle());
#endif
HFONT f = (HFONT) ::SelectObject((HDC) m_hDC, (HFONT) m_font.GetResourceHandle());
+ if (f == NULL)
+ {
+ wxDebugMsg("::SelectObject failed in wxDC::SetFont.");
+ }
if (!m_oldFont)
m_oldFont = (WXHFONT) f;
}
void wxDC::DrawText(const wxString& text, long x, long y, bool use16bit)
{
+ // Should be unnecessary: SetFont should have done this already.
+#if 0
if (m_font.Ok() && m_font.GetResourceHandle())
{
#if WXDEBUG > 1
if (!m_oldFont)
m_oldFont = (WXHFONT) f;
}
+#endif
if (m_textForegroundColour.Ok())
SetTextColor((HDC) m_hDC, m_textForegroundColour.GetPixel() ) ;
if (!this->IsKindOf(CLASSINFO(wxPrinterDC)))
return TRUE;
- bool flag = FALSE;
-
DOCINFO docinfo;
docinfo.cbSize = sizeof(DOCINFO);
docinfo.lpszDocName = (const char *)message;
- docinfo.lpszOutput = (const char *)m_filename;
+
+ if (m_filename.IsEmpty())
+ docinfo.lpszOutput = NULL;
+ else
+ docinfo.lpszOutput = (const char *)m_filename;
+
#if defined(__WIN95__)
docinfo.lpszDatatype = NULL;
docinfo.fwType = 0;
#endif
- if (m_hDC) flag = (SP_ERROR !=
+ if (!m_hDC)
+ return FALSE;
+
+ int ret =
#ifndef __WIN32__
- ::StartDoc((HDC) m_hDC, &docinfo));
+ ::StartDoc((HDC) m_hDC, &docinfo);
#else
#ifdef UNICODE
- ::StartDocW((HDC) m_hDC, &docinfo));
+ ::StartDocW((HDC) m_hDC, &docinfo);
#else
- ::StartDocA((HDC) m_hDC, &docinfo));
+ ::StartDocA((HDC) m_hDC, &docinfo);
#endif
#endif
- else flag = FALSE;
-
- return flag;
+ if (ret <= 0)
+ {
+ DWORD lastError = GetLastError();
+ wxDebugMsg("wxDC::StartDoc failed with error: %d\n", lastError);
+ }
+ return (ret > 0);
}
void wxDC::EndDoc(void)