ergoktas
04/01/2007, 09:42
Arkadaşlar Merhaba,
LPT 1 den dotmatrix(nokta vuruşlu) yazıcıya yazdırma işlemlerini yönetmek için bir class yazdım, printer emulasyonuna göre (IBM veya EPSON) yazıcıya escape sequnce (kaçış sekansları) lar gönderiyoruz , yazdığım class ta aynen bir dosya açar gibi LPT1 i açıp bir streamwriter nesnesi oluşturup onun üzerinden escape sequence lar gönderiyoruz.
Mesela karakteri bold yapmak için class içinde aşağıdaki fonksiyonu çağırıyoruz.
public void Bold(bool Value)
{
if (Opened)
{
// IBM
if (MyEmulation == "IBM")
{
if (Value)
{
S_W.Write("\x1B\x47");
}
// NLQ
else
{
S_W.Write("\x1B\x48");
}
}
// EPSON
else if (MyEmulation == "EPSON")
{
if (Value)
{
S_W.Write("\x1B\x78" + "\x1");
}
else
{
S_W.Write("\x1B\x78" + "\x0");
}
}
}
}
Ancak portu açma sırasında şu exception oluşuyor :
FileStream will not open win32 devides such as disk partitions and tape drives. Avoid use of "\\.\" in the path
Portu şu şekilde açıyoruz -->
public void Open(string sPort)
{
if (!Opened)
{
// sPort 'PRN', 'LPT1' veya 'LPT2' olabilir.
if ((sPort == "PRN") || (sPort == "LPT1") || (sPort == "LPT2"))
{
Handle = new FileInfo(sPort);
try
{
StreamWriter S_W = Handle.CreateText();
}
catch (System.Exception ex)
{
MessageBox.Show("Exception :" + ex.Message);
}
Opened = true;
this.Reset();
}
}
}
arkadaşlar nerde hata yapıyorum acaba, dotmatrix yazıcıya yazdırma mantığında mı bir hata var, yoksa nerde acaba ?
şimdiden tesekkürler ...
LPT 1 den dotmatrix(nokta vuruşlu) yazıcıya yazdırma işlemlerini yönetmek için bir class yazdım, printer emulasyonuna göre (IBM veya EPSON) yazıcıya escape sequnce (kaçış sekansları) lar gönderiyoruz , yazdığım class ta aynen bir dosya açar gibi LPT1 i açıp bir streamwriter nesnesi oluşturup onun üzerinden escape sequence lar gönderiyoruz.
Mesela karakteri bold yapmak için class içinde aşağıdaki fonksiyonu çağırıyoruz.
public void Bold(bool Value)
{
if (Opened)
{
// IBM
if (MyEmulation == "IBM")
{
if (Value)
{
S_W.Write("\x1B\x47");
}
// NLQ
else
{
S_W.Write("\x1B\x48");
}
}
// EPSON
else if (MyEmulation == "EPSON")
{
if (Value)
{
S_W.Write("\x1B\x78" + "\x1");
}
else
{
S_W.Write("\x1B\x78" + "\x0");
}
}
}
}
Ancak portu açma sırasında şu exception oluşuyor :
FileStream will not open win32 devides such as disk partitions and tape drives. Avoid use of "\\.\" in the path
Portu şu şekilde açıyoruz -->
public void Open(string sPort)
{
if (!Opened)
{
// sPort 'PRN', 'LPT1' veya 'LPT2' olabilir.
if ((sPort == "PRN") || (sPort == "LPT1") || (sPort == "LPT2"))
{
Handle = new FileInfo(sPort);
try
{
StreamWriter S_W = Handle.CreateText();
}
catch (System.Exception ex)
{
MessageBox.Show("Exception :" + ex.Message);
}
Opened = true;
this.Reset();
}
}
}
arkadaşlar nerde hata yapıyorum acaba, dotmatrix yazıcıya yazdırma mantığında mı bir hata var, yoksa nerde acaba ?
şimdiden tesekkürler ...