I have mistakes in my code. My printer which name is "XP-58" does not print text from C++ program. But when I run print from notepat, it works correctrly. My C++ code
int _tmain(int argc, _TCHAR* argv[])
{
LPTSTR printerName = (LPTSTR)_T("XP-58");
CString str = "la-la-la";
LPBYTE pByte = new BYTE[str.GetLength() + 1];
memcpy(pByte, (VOID*)LPCTSTR(str), str.GetLength());
DWORD count = 7;
BOOL result = RawDataToPrinter(printerName, pByte, count);
std::cout << result << std::endl;
system("pause");
return 0;
}
I using function from here https://msdn.microsoft.com/en-us/library/windows/desktop/dd162959(v=vs.85).aspx
As you can see I have result after program end "std::cout << result << std::endl;" and result always shows "1".
Which is the problem? May be I need set specify port for printer? My printer connected to USB002 port. And when I start printing from notepad I see this port in "Print queue manager", but when task added from my program I don't see any port in manager. Please help)
Aucun commentaire:
Enregistrer un commentaire