Question : How Can I Detect, Delete, and Add A Printer In Windows XP using Visual Basic, C#, or C++

Hello everyone.
This one is a challenging problem.  I work in an environment that has many printers available through our network.  I have a situation where a few hundred people have the wrong printer defined on their Windows XP Pro PCs. I need a program to detect if the user is one of the ones with the wrong printer in their list of printers (the list shown in the Printers and Faxes window).  They might have that printer set as their default but not necessarily.  If I find that they are one of the ones with the wrong printer then I need the program to delete the particular printer from their list of and add the correct printer to their list.  Once the correct printer has been added, I also need to set it as th default.  

Ideally I am looking for a solution in Visual .NET Framework but everywhere I look it appears people are saying it has to be done with unmanaged code.  If it truely can not be done with managed code then an example that performs the above with Visual Basic .NET with unamanaged code will do as the next preference.  If it can't be done with Visual Basic then I can also work with an example in C# is the next preference.  If the answer to this problem still can not be done with Visual Basic .NET or C# the I will also accept a C++ example but C++ is the last resort and not the preference.  

Thanks in advance

Answer : How Can I Detect, Delete, and Add A Printer In Windows XP using Visual Basic, C#, or C++

Well, in the order of your subject line:

http://msdn2.microsoft.com/en-us/library/ms536005.aspx ("EnumPrinters")
http://msdn2.microsoft.com/en-us/library/ms535644.aspx ("DeletePrinter")
http://msdn2.microsoft.com/en-us/library/ms535500.aspx ("AddPrinter")

Regarding teh detection, you will find sample code at http://www.winterdom.com/dev/ptk/enumprint.c

Oh, and here's even some sample code in VB: http://vbnet.mvps.org/index.html?code/system/addprinter.htm
Random Solutions  
 
programming4us programming4us