C# - Popup my application whenever print happened to test driver

1.3k Views Asked by At

I am working on the assignment to write a Virtual Printer with C# and NTDDK.

I have created a test printer driver and I am able to print .ps documents(redirected to C:\test\test.ps always) using it. But now I have to write a small application that will popup a messagebox saying "Print is done" using C# but I am not able to figure out how to do it?

Can anyone help me in this?

Thanks in advance!

1

There are 1 best solutions below

6
On BEST ANSWER

Use the endprint event...that is something like, in the designer code put:

/////////////// something.EndPrint += new PrintEventHandler(endingclass); //////////////

in the form constructor, or anywhere in the program/form where you can call the method put:

private void endingclass(object sender, PrintEventArgs e)

{

MessageBox.Show("wazaaaaaaaaaaaaaaaaa");

}

//////// Obviously, you need to make some...arrangements in the code above - but I believe they are self evident. In case you have problems, googl the endprint event, it will 100% has some examples associated with it.

//// On a side note...if you're really bored you can think of asynchronous process which checks the process every....1/10 of a second :). It will work, but it's a bizarre way to accomplish such a thing. Since you're a c++ developer, c# should be easy to you, you'll like it, it's more powerfull than c++ anyway.