Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. Is this bad?

Is this bad?

Scheduled Pinned Locked Moved The Weird and The Wonderful
question
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    James_Parsons
    wrote on last edited by
    #1

    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

    T N 2 Replies Last reply
    0
    • J James_Parsons

      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

      T Offline
      T Offline
      Tim Carmichael
      wrote on last edited by
      #2

      Bad? Maybe. Unfortunate? Yes. Looks like he is working with Zebra printers; better he than me!

      1 Reply Last reply
      0
      • J James_Parsons

        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

        N Offline
        N Offline
        Nish Nishant
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups