how to set a printer to pause and resume ?

phicha

Well-known member
Joined
May 11, 2009
Messages
45
Programming Experience
Beginner
i am using vb dot net, and i try to stop and resume printing my printer,
but somehow i still dont found yet, how to do this thing using vb dot net.
please someone give me clue using what object to control my printer ? i try using printing but not found the method...

thanks,
 
WMI class Win32_Printer has Pause and Resume methods, see this thread about using WMI: http://www.vbdotnetforums.com/articles-interest/13972-wmi-code-creator-1-0-a.html See especially post 5 that explains how you can do this with just a few lines of code. Here's another sample that gets a printer by name:
VB.NET:
Dim condition As String = String.Format("Name=""{0}""", "Printer name")
Dim printer As Win32.Printer = CType(Win32.Printer.GetInstances(condition)(0), Win32.Printer)
printer.Pause()
'printer.Resume()
printer.Dispose()
 
that program does cool.
i tried it to generete pause and resume vb script,
and it work finely for me.

but still i never learned about wmi, is there some a book that discuss this thing ?


thank you very much,
 
I'm sure there is, I've only used MSDN help topics and web tutorials around myself. Normally I only use it when .Net class library lacks the functionality, WMI usually makes such things easier that calling native Win32 functions. Scripting languages have far more benefit from it.
Windows Management Instrumentation (Windows)
System.Management Namespace ()
i tried it to generete pause and resume vb script,
To generated VB.Net code change in Code Language menu, but as mentioned using the WMI classes as VB.Net classes is far more convenient.
 
sir, since we using vb dot net to run vbs. how to run vbs from vb dot net ?
using shell "cscript file.vbs" to execute ?

thanks,
 
Back
Top