Is this bad?
-
I open the code of a friend of a friend and I see several lines like:
[DllImport("ZBRPrinter.dll", EntryPoint = "ZBRPRNReadMag", CharSet = CharSet.Auto, SetLastError = true)]
static extern int ZBRPRNReadMag(IntPtr _handle, int prn_type, int trksToRead, byte[] trk1Buf,
out int trk1BytesNeeded, byte[] trk2Buf, out int trk2BytesNeeded, byte[] trk3Buf,
out int trk3BytesNeeded, out int err);\[DllImport("ZBRPrinter.dll", EntryPoint = "ZBRPRNWriteMag", CharSet = CharSet.Auto, SetLastError = true)\] static extern int ZBRPRNWriteMag(IntPtr \_handle, int prn\_type, int trksToWrite, byte\[\] trk1Data, byte\[\] trk2Data, byte\[\] trk3Data, out int err);
Oh boy, calling a bunch of un-managed drivers from managed codes sounds fun.
i cri evry tiem
-
I open the code of a friend of a friend and I see several lines like:
[DllImport("ZBRPrinter.dll", EntryPoint = "ZBRPRNReadMag", CharSet = CharSet.Auto, SetLastError = true)]
static extern int ZBRPRNReadMag(IntPtr _handle, int prn_type, int trksToRead, byte[] trk1Buf,
out int trk1BytesNeeded, byte[] trk2Buf, out int trk2BytesNeeded, byte[] trk3Buf,
out int trk3BytesNeeded, out int err);\[DllImport("ZBRPrinter.dll", EntryPoint = "ZBRPRNWriteMag", CharSet = CharSet.Auto, SetLastError = true)\] static extern int ZBRPRNWriteMag(IntPtr \_handle, int prn\_type, int trksToWrite, byte\[\] trk1Data, byte\[\] trk2Data, byte\[\] trk3Data, out int err);
Oh boy, calling a bunch of un-managed drivers from managed codes sounds fun.
i cri evry tiem
Bad? Maybe. Unfortunate? Yes. Looks like he is working with Zebra printers; better he than me!
-
I open the code of a friend of a friend and I see several lines like:
[DllImport("ZBRPrinter.dll", EntryPoint = "ZBRPRNReadMag", CharSet = CharSet.Auto, SetLastError = true)]
static extern int ZBRPRNReadMag(IntPtr _handle, int prn_type, int trksToRead, byte[] trk1Buf,
out int trk1BytesNeeded, byte[] trk2Buf, out int trk2BytesNeeded, byte[] trk3Buf,
out int trk3BytesNeeded, out int err);\[DllImport("ZBRPrinter.dll", EntryPoint = "ZBRPRNWriteMag", CharSet = CharSet.Auto, SetLastError = true)\] static extern int ZBRPRNWriteMag(IntPtr \_handle, int prn\_type, int trksToWrite, byte\[\] trk1Data, byte\[\] trk2Data, byte\[\] trk3Data, out int err);
Oh boy, calling a bunch of un-managed drivers from managed codes sounds fun.
i cri evry tiem
It may be cleaner to write the printer interaction in a C++ library and then export simpler functions that are called from C#, or even a very thin C++/CLI wrapper.
Regards, Nish
Website: www.voidnish.com Blog: voidnish.wordpress.com