私はEpsonTM-U220Aを持っています。領収書を印刷するために、C#デスクトップアプリケーションを作成しています。しかし、プリンターが見つかりません。
メモ帳を介して何かを送信すると、プリンターは奇妙な文字を印刷します(したがって、その動作)
私は次のものを持っています:
- POS for .Net v1.12.exe
- OPOSN1.11.16(.net用Esponラッパー)
- エプソンドライバーがインストールされています
- プリンターへのUSBインターフェース。
コード:
private void FormLoad(object sender, System.EventArgs e)
{
//<<<step1>>>--Start
//Use a Logical Device Name which has been set on the SetupPOS.
string strLogicalName = "PosPrinter";
// string strLogicalName = "ESDPRT001";
try
{
//Create PosExplorer
PosExplorer posExplorer = new PosExplorer();
DeviceInfo deviceInfo = null;
try
{
deviceInfo = posExplorer.GetDevice(DeviceType.PosPrinter, strLogicalName);
m_Printer = (PosPrinter)posExplorer.CreateInstance(deviceInfo);
}
catch (Exception)
{
ChangeButtonStatus();
return;
}
//Open the device
m_Printer.Open();
//Get the exclusive control right for the opened device.
//Then the device is disable from other application.
m_Printer.Claim(1000);
//Enable the device.
m_Printer.DeviceEnabled = true;
}
catch (PosControlException)
{
ChangeButtonStatus();
}
//<<<step1>>>--End
}
エラー:ポート名が不正であるか、デバイスに接続できませんでした。オンライン:m_Printer.Claim(1000);