473,573 Members | 4,115 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WMI printer job monitoring issue

hi, i have written a small print job monitoring program which can monitor the
job ID and total pages printed .
i am facing on strange problem which is the total print pages is always
equal to 1 , not matter how many pages i have printing .
anyone have facing the same issue ? and any solution on this issue ?

the code i written as bellow

timer1.Stop () ;

string f_SearchQuery = "SELECT * FROM Win32_PrintJob" ;
ManagementObjec tSearcher f_SearchPrintJo bs = new
ManagementObjec tSearcher(f_Sea rchQuery);
ManagementObjec tCollection f_PrntJobCollec tion = f_SearchPrintJo bs.Get();

foreach(Managem entObject f_PrntJob in f_PrntJobCollec tion)
{

m_JobID = f_PrntJob.Prope rties["JobId"].Value.ToString () ;
m_TotalPages = f_PrntJob.Prope rties["TotalPages "].Value.ToString () ;
WriteToFile (m_TotalPages,m _JobID) ;
}

Timer1.Start () ;
Nov 17 '05 #1
4 8673
And what program is used for the actual printing?
If the document is not page "formatted" it might be considered a single page
documenet.

Willy.

"sengkok" <se*****@discus sions.microsoft .com> wrote in message
news:21******** *************** ***********@mic rosoft.com...
hi, i have written a small print job monitoring program which can monitor
the
job ID and total pages printed .
i am facing on strange problem which is the total print pages is always
equal to 1 , not matter how many pages i have printing .
anyone have facing the same issue ? and any solution on this issue ?

the code i written as bellow

timer1.Stop () ;

string f_SearchQuery = "SELECT * FROM Win32_PrintJob" ;
ManagementObjec tSearcher f_SearchPrintJo bs = new
ManagementObjec tSearcher(f_Sea rchQuery);
ManagementObjec tCollection f_PrntJobCollec tion = f_SearchPrintJo bs.Get();

foreach(Managem entObject f_PrntJob in f_PrntJobCollec tion)
{

m_JobID = f_PrntJob.Prope rties["JobId"].Value.ToString () ;
m_TotalPages = f_PrntJob.Prope rties["TotalPages "].Value.ToString () ;
WriteToFile (m_TotalPages,m _JobID) ;
}

Timer1.Start () ;

Nov 17 '05 #2
actually i am printing a notepad file , and i select to print 2 copy of it.

"Willy Denoyette [MVP]" wrote:
And what program is used for the actual printing?
If the document is not page "formatted" it might be considered a single page
documenet.

Willy.

"sengkok" <se*****@discus sions.microsoft .com> wrote in message
news:21******** *************** ***********@mic rosoft.com...
hi, i have written a small print job monitoring program which can monitor
the
job ID and total pages printed .
i am facing on strange problem which is the total print pages is always
equal to 1 , not matter how many pages i have printing .
anyone have facing the same issue ? and any solution on this issue ?

the code i written as bellow

timer1.Stop () ;

string f_SearchQuery = "SELECT * FROM Win32_PrintJob" ;
ManagementObjec tSearcher f_SearchPrintJo bs = new
ManagementObjec tSearcher(f_Sea rchQuery);
ManagementObjec tCollection f_PrntJobCollec tion = f_SearchPrintJo bs.Get();

foreach(Managem entObject f_PrntJob in f_PrntJobCollec tion)
{

m_JobID = f_PrntJob.Prope rties["JobId"].Value.ToString () ;
m_TotalPages = f_PrntJob.Prope rties["TotalPages "].Value.ToString () ;
WriteToFile (m_TotalPages,m _JobID) ;
}

Timer1.Start () ;


Nov 17 '05 #3
The "totalpages " has nothing to do with the number of copies, it's the
number of pages per copy. So if your document is less that two pages long,
totalpages will be one irrespective the number of copies.

Willy.

"sengkok" <se*****@discus sions.microsoft .com> wrote in message
news:CE******** *************** ***********@mic rosoft.com...
actually i am printing a notepad file , and i select to print 2 copy of
it.

"Willy Denoyette [MVP]" wrote:
And what program is used for the actual printing?
If the document is not page "formatted" it might be considered a single
page
documenet.

Willy.

"sengkok" <se*****@discus sions.microsoft .com> wrote in message
news:21******** *************** ***********@mic rosoft.com...
> hi, i have written a small print job monitoring program which can
> monitor
> the
> job ID and total pages printed .
> i am facing on strange problem which is the total print pages is always
> equal to 1 , not matter how many pages i have printing .
> anyone have facing the same issue ? and any solution on this issue ?
>
> the code i written as bellow
>
> timer1.Stop () ;
>
> string f_SearchQuery = "SELECT * FROM Win32_PrintJob" ;
> ManagementObjec tSearcher f_SearchPrintJo bs = new
> ManagementObjec tSearcher(f_Sea rchQuery);
> ManagementObjec tCollection f_PrntJobCollec tion =
> f_SearchPrintJo bs.Get();
>
> foreach(Managem entObject f_PrntJob in f_PrntJobCollec tion)
> {
>
> m_JobID = f_PrntJob.Prope rties["JobId"].Value.ToString () ;
> m_TotalPages = f_PrntJob.Prope rties["TotalPages "].Value.ToString () ;
> WriteToFile (m_TotalPages,m _JobID) ;
> }
>
> Timer1.Start () ;


Nov 17 '05 #4
ok . today i have done another testing in a network printer. i receive 0
value in totalpages when i try to print single page of word document. can i
know what is excatly the "totalpages " value is used for ?
another question , do i have any way to know that how many copies had been
printed from the print job wmi ? or any solution on it

thanks

"Willy Denoyette [MVP]" wrote:
The "totalpages " has nothing to do with the number of copies, it's the
number of pages per copy. So if your document is less that two pages long,
totalpages will be one irrespective the number of copies.

Willy.

"sengkok" <se*****@discus sions.microsoft .com> wrote in message
news:CE******** *************** ***********@mic rosoft.com...
actually i am printing a notepad file , and i select to print 2 copy of
it.

"Willy Denoyette [MVP]" wrote:
And what program is used for the actual printing?
If the document is not page "formatted" it might be considered a single
page
documenet.

Willy.

"sengkok" <se*****@discus sions.microsoft .com> wrote in message
news:21******** *************** ***********@mic rosoft.com...
> hi, i have written a small print job monitoring program which can
> monitor
> the
> job ID and total pages printed .
> i am facing on strange problem which is the total print pages is always
> equal to 1 , not matter how many pages i have printing .
> anyone have facing the same issue ? and any solution on this issue ?
>
> the code i written as bellow
>
> timer1.Stop () ;
>
> string f_SearchQuery = "SELECT * FROM Win32_PrintJob" ;
> ManagementObjec tSearcher f_SearchPrintJo bs = new
> ManagementObjec tSearcher(f_Sea rchQuery);
> ManagementObjec tCollection f_PrntJobCollec tion =
> f_SearchPrintJo bs.Get();
>
> foreach(Managem entObject f_PrntJob in f_PrntJobCollec tion)
> {
>
> m_JobID = f_PrntJob.Prope rties["JobId"].Value.ToString () ;
> m_TotalPages = f_PrntJob.Prope rties["TotalPages "].Value.ToString () ;
> WriteToFile (m_TotalPages,m _JobID) ;
> }
>
> Timer1.Start () ;


Nov 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1126
by: Dan | last post by:
Does .NET provide any way to implement printer monitoring (similar to FindFirstPrinterNotification), or is it necessary to call the API?
3
10035
by: Gordon Truslove | last post by:
I've been trying to get the printer status using GetPrinter and Printer_Info_2 I'm getting closer, but it still fails. Error 122 - The data area passed to a system call is too small. --------------------------------------------------------------- public struct PRINTERINFO2
1
4266
by: Mortel | last post by:
Hi, How I can get information from printer about count of copy pages, who's print pages etc. I want monitoring printers and save that information to file log. Maybe printer has any events to do that ? Thank's for all. Boniek
0
1662
by: sengkok | last post by:
hi, i have written a printer job monitoring program as the code shown below , a timer is used to call this function every second . i have a network printer tat attached to my pc. i facing a problems that some time the program can detect the print job but some how most of the time it cant detect any printer job while actually the printing...
9
3191
by: Tim D | last post by:
Hi, I originally posted this as a reply to a rather old thread in dotnet.framework.general and didn't get any response. I thought it might be more relevant here; anyone got any ideas? My questions are below... "David Good" wrote: > We have a network running both Win2k and Win2k3 webservers and our web sites > reside on a UNC network...
5
2864
by: Jay Ge | last post by:
I searched this issue in internet, but they still cannot solve my issue, so your help/suggestion will be preciated. this page is placed on serverA, and it will touch files on serverB.(but it seems this is not double hop issue.) I use impersonation <identity impersonate="true" userName="domain\username" password="passwd" /> and...
3
5100
by: Olaf Rabbachin | last post by:
Hi folks, during printing, I'm constantly checking the printer-spooler to monitor whether a document has showed up in a printer's spooler and - after it has - whether the print-job has been finished. I'm using the following code for that: --- 8< --- Imports System.Management
14
531
by: werdna.sivad | last post by:
I need to develop some software that will step in between a computer and it's printer. The software should read from one LPT port (connected to printing computer) and then redirect that traffic out a second LPT port (connected to printer). It will do stuff to the data as it goes by. Can you give me any direction on what is needed to...
0
1376
by: Mark | last post by:
Hello, I have a VB6 Project that uses an ini file to save selected printer settings for several forms. The program allows users to select the printer on their work station for printing forms. If a printer is not selected for a particular form, the user is prompted to select a printer. The program saves the printer selections to an ini...
0
7789
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7707
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
6432
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5605
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5296
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3737
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3743
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2227
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1048
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.