WIN API & C#

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • MaxBici

    WIN API & C#

    In c# ,
    I use wmi to monitor print job but I need to get PrintJob 's number of
    copies and wmi don't expose it.
    So i think to use win API but I am a newbie of Pinvoke.
    This is function declaration:
    [DllImport("wins pool.drv", EntryPoint="Get Job")] public static extern int
    GetJobA
    (int hPrinter, int JobId, int Level, ref byte pJob, int cdBuf, ref int
    pcbNeeded)

    Anyone can help me , any example to use this function?
    Thanks in advance
    Max


  • Morten Wennevik

    #2
    Re: WIN API & C#

    Hi Max,

    You should take a look at



    I couldn't find an entry for GetJob, but assuming your pJob returns an array of job structures, you can either read the array by hand or use Marshalling for transforming the byte[] -> Job struct

    The JOB_INFO_1 structure specifies print-job information such as the job-identifier value, the name of the printer for which the job is spooled, the name of the machine that created the print job, the name of the user that owns the print job, and so on.




    On Wed, 25 May 2005 15:15:40 +0200, MaxBici <MaxBici@discus sions.microsoft .com> wrote:
    [color=blue]
    > In c# ,
    > I use wmi to monitor print job but I need to get PrintJob 's number of
    > copies and wmi don't expose it.
    > So i think to use win API but I am a newbie of Pinvoke.
    > This is function declaration:
    > [DllImport("wins pool.drv", EntryPoint="Get Job")] public static extern int
    > GetJobA
    > (int hPrinter, int JobId, int Level, ref byte pJob, int cdBuf, ref int
    > pcbNeeded)
    >
    > Anyone can help me , any example to use this function?
    > Thanks in advance
    > Max
    >
    >
    >[/color]



    --
    Happy coding!
    Morten Wennevik [C# MVP]

    Comment

    • Buddy Home

      #3
      Re: WIN API &amp; C#

      Check the following URL which will give you the conversion




      "MaxBici" <MaxBici@discus sions.microsoft .com> wrote in message
      news:EF07EB62-461F-4604-9253-B3A550AE23F1@mi crosoft.com...[color=blue]
      > In c# ,
      > I use wmi to monitor print job but I need to get PrintJob 's number of
      > copies and wmi don't expose it.
      > So i think to use win API but I am a newbie of Pinvoke.
      > This is function declaration:
      > [DllImport("wins pool.drv", EntryPoint="Get Job")] public static extern int
      > GetJobA
      > (int hPrinter, int JobId, int Level, ref byte pJob, int cdBuf, ref int
      > pcbNeeded)
      >
      > Anyone can help me , any example to use this function?
      > Thanks in advance
      > Max
      >
      >[/color]


      Comment

      Working...