Tags: array, byte, call, convert, dwcount, int32, intptr, method, microsoft, msdn, pbytes, publicstaticbool, sendbytestoprinter, software, string, szprintername, visual

How to convert byte[] to IntPtr

On Microsoft » Microsoft Visual C#

612 words with 1 Comments; publish: Sat, 05 Jan 2008 20:15:00 GMT; (30078.13, « »)

I have an array of byte and I need to call this method:

publicstaticbool SendBytesToPrinter(string szPrinterName, IntPtr pBytes, Int32 dwCount)

You see? So how am I going to change the byte[] to IntPtr?

Please help. I will reward you.

All Comments

Leave a comment...

    • Just define your method to accept an array. IntPtr is to be used for interop with native code, you can't convert an array to a pointer in safe code, only in unsafe code or when marshaling to unsafe native code.
      #1; Wed, 03 Oct 2007 21:16:00 GMT