Hi all
Below is a MFC code which is used for printing
void CMFCSample1Dlg::OnBnClickedWrite()
{
UpdateData(TRUE);
if (m_vckWriteFile) {
CString name;
m_cbWriteFile.GetWindowText(name);
CFile file;
if (file.Open(name, CFile::modeRead) == FALSE) {
return;
}
TCHAR Buff[4096];
DWORD dwLen;
dwLen = (DWORD)file.GetLength();
if (4096 < dwLen) {
file.Close();
return;
}
file.Read(Buff, dwLen);
file.Close();
DWORD r = PrtWrite(Buff, dwLen);
TCHAR buf[64];
GetErrorMessage(r, buf, 64);
CString mes;
mes.Format("PrtWrite(<%s>, %d): %d\n<%s>", name, dwLen, r, buf);
MessageBox(mes);
} else {
TCHAR Buff[256];
DWORD dwLen = m_vedWrite.GetLength();
if (254 < dwLen) {
return;
}
_tcscpy(Buff, m_vedWrite);
Buff[dwLen] = 0x0D;
dwLen++;
Buff[dwLen] = 0;
DWORD r = PrtWrite(Buff, dwLen);
TCHAR buf[64];
GetErrorMessage(r, buf, 64);
CString mes;
mes.Format("PBWrite(%s, %d): %d\n<%s>", m_vedWrite, dwLen, r, buf);
MessageBox(mes);
}
}
I am not able to do this in c#.
can anyone help me on this please.
I need to print one notepad file using this.