Results 1 to 7 of 7

Thread: [RESOLVED] print que

Hybrid View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2003
    Location
    ohio, usa
    Posts
    719

    Resolved [RESOLVED] print que

    how can I display the "print que" ??

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: print que

    I don't claim to know how but I'm fairly sure it would involve unmanaged code. There may be a Windows API function or two, or maybe you could use WMI.

    Edit: Just had a quick look at the API Guide and there's an EnumJobs function in the Windows API. That would be worth a look.

    By the way, it's "queue", not "que".
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2003
    Location
    ohio, usa
    Posts
    719

    Re: print que

    Quote Originally Posted by jmcilhinney
    I don't claim to know how but I'm fairly sure it would involve unmanaged code. There may be a Windows API function or two, or maybe you could use WMI.

    Edit: Just had a quick look at the API Guide and there's an EnumJobs function in the Windows API. That would be worth a look.

    By the way, it's "queue", not "que".
    I have seen "q" spelled 3-4 different ways.

  4. #4
    PowerPoster
    Join Date
    Jul 2002
    Location
    Dublin, Ireland
    Posts
    2,148

    Re: print que

    There is an API call "EnumJobs" that lists the jobs in a given print queue:
    Code:
        ' JobInfoLevels - The level (JOB_LEVEL_n) structure to read from the spooler
        Public Enum JobInfoLevels
            ' JobInfoLevel1 - Read a JOB_INFO_1 structure
            JobInfoLevel1 = &H1
            ' JobInfoLevel2 - Read a JOB_INFO_2 structure
            JobInfoLevel2 = &H2
            ' JobInfoLevel3 - Read a JOB_INFO_3 structure
            JobInfoLevel3 = &H3
        End Enum
    
        <DllImport("winspool.drv", EntryPoint:="EnumJobs", _
     SetLastError:=True, CharSet:=CharSet.Ansi, _
     ExactSpelling:=False, _
     CallingConvention:=CallingConvention.StdCall)> _
    Public Function EnumJobs _
                    (<InAttribute()> ByVal hPrinter As IntPtr, _
                     <InAttribute()> ByVal FirstJob As Int32, _
                     <InAttribute()> ByVal NumberOfJobs As Int32, _
     <InAttribute(), MarshalAs(UnmanagedType.U4)> ByVal Level As JobInfoLevels, _
     <OutAttribute()> ByVal pbOut As IntPtr, _
     <InAttribute()> ByVal cbIn As Int32, _
     <OutAttribute()> ByRef pcbNeeded As Int32, _
     <OutAttribute()> ByRef pcReturned As Int32 _
      ) As Boolean
    
    
        End Function
    The source code for the printer usage monitoring application uses this and the related API calls - I'd suggest you download that as a reference...

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2003
    Location
    ohio, usa
    Posts
    719

    Re: print que

    Quote Originally Posted by Merrion
    There is an API call "EnumJobs" that lists the jobs in a given print queue:
    Code:
        ' JobInfoLevels - The level (JOB_LEVEL_n) structure to read from the spooler
        Public Enum JobInfoLevels
            ' JobInfoLevel1 - Read a JOB_INFO_1 structure
            JobInfoLevel1 = &H1
            ' JobInfoLevel2 - Read a JOB_INFO_2 structure
            JobInfoLevel2 = &H2
            ' JobInfoLevel3 - Read a JOB_INFO_3 structure
            JobInfoLevel3 = &H3
        End Enum
    
        <DllImport("winspool.drv", EntryPoint:="EnumJobs", _
     SetLastError:=True, CharSet:=CharSet.Ansi, _
     ExactSpelling:=False, _
     CallingConvention:=CallingConvention.StdCall)> _
    Public Function EnumJobs _
                    (<InAttribute()> ByVal hPrinter As IntPtr, _
                     <InAttribute()> ByVal FirstJob As Int32, _
                     <InAttribute()> ByVal NumberOfJobs As Int32, _
     <InAttribute(), MarshalAs(UnmanagedType.U4)> ByVal Level As JobInfoLevels, _
     <OutAttribute()> ByVal pbOut As IntPtr, _
     <InAttribute()> ByVal cbIn As Int32, _
     <OutAttribute()> ByRef pcbNeeded As Int32, _
     <OutAttribute()> ByRef pcReturned As Int32 _
      ) As Boolean
    
    
        End Function
    The source code for the printer usage monitoring application uses this and the related API calls - I'd suggest you download that as a reference...

    ok and thanks!!!

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: print que

    There is also the QueryInformationJobObject for getting details that you may need to also display about print jobs in the "Q"
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: print que

    Then you've seen it spelled wrongly 2-3 different ways. The word is "queue".
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width