Thanks to everyone that offered some advice. I know that our trying to block certain printers will tick some people off.
We are working on a specialized coupon system and this is just one attempt to prevent multiple printings of the same coupon. We are also adding serial numbers, etc. but we are trying to do something simple like the "CLUB" That thing that supposedly protectes your car. Yet if someone just cuts through the stearing wheel they can remove the club in seconds. We are not trying to make it 100% impossible to cheat with our program, but we are trying to "keep the honest man honest." I think that there may be some minor problems with this method, yet to protect our clients we need to make some efforts in trying to prevent multiple copies. So with serial numbers, copy protections images and preventing printing to some of the basic eBook printer drivers I think we will have done all we can. I know it's not perfect. I just hope it's good enough. Thanks again!! Mike -----Original Message----- From: Discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] On Behalf Of Peter Ritchie Sent: Tuesday, January 23, 2007 6:24 AM To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM Subject: Re: [ADVANCED-DOTNET] PrinterSettings.OutputPort in C# As far as I've been able to tell (I haven't tried to reflect the method) GetOutputPort simply returns the name of the printer. Microsoft has put a lot of justifiable effort into abstracting printers to make printing in Windows very generalized. A trade-off to such a level of abstraction is losing some of the details. I think it's near impossible to generally limit printing to printers based on some hardware-level feature. If I encountered "Please use a different printer", I'd quickly move on to a different product... On Tue, 23 Jan 2007 06:40:21 +0200, Brady Kelly <[EMAIL PROTECTED]> wrote: >If the property being private is your issue, can't you use reflection to get >its value? > >> -----Original Message----- >> From: Discussion of advanced .NET topics. [mailto:ADVANCED- >> [EMAIL PROTECTED] On Behalf Of MIke Collins >> Sent: 22 January 2007 21:31 PM >> To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM >> Subject: [ADVANCED-DOTNET] PrinterSettings.OutputPort in C# >> >> I need to find a way to gain access to the name of the printer port when >> trying to print. >> >> What I am trying to do is make sure that the user does not print to an >> electronic format. For example PDF, Microsoft Office Image Writer, >> PaperPort, etc. I only want the user to be able to print directly to a >> physical printer. >> >> It is possible for the user to change the name of the printer. For >> example >> the default name for the Adobe PDF printer is "Adobe PDF" but this name >> can >> be changed by the user to something like "Adobe P.D.F." This would >> prevent >> me from being able to halt printing based on the printer name. >> >> BUT!! The PrinterSettings.OutputPort (Which is not public) can not be >> changed as easily. I would like to be able to get that value so I can >> check >> that to make sure that the user is not printing to PDF, etc. >> >> Does anyone have any clues?? >> >> Thanks, >> Mike >> >> Here is a small code snipet: >> PrintDocument pd = new PrintDocument(); >> >> while( true ) >> { >> PrintDialog dlg = new PrintDialog(); >> dlg.PrinterSettings = pd.PrinterSettings; >> dlg.AllowCurrentPage = false; >> dlg.AllowSelection = false; >> dlg.AllowSomePages = false; >> dlg.AllowPrintToFile = false; >> dlg.PrinterSettings.Copies = 1; >> dlg.PrinterSettings.DefaultPageSettings.Landscape = >> true; >> dlg.UseEXDialog = false; >> >> if( dlg.ShowDialog() == DialogResult.OK ) >> { >> // Here we check to see if the user is >> attempting to >> print >> // to a printer that we won't accept. (PDF, >> etc.) >> string temp = >> pd.PrinterSettings.PrinterName.ToLower(); >> if( temp.IndexOf( "pdf" ) > -1 || >> temp.IndexOf( "image writer" ) > -1 || >> temp.IndexOf( "paperport" ) > -1 ) >> { >> MessageBox.Show( "Invalid printer type. >> Please select a different printer." ); >> } =================================== This list is hosted by DevelopMentorR http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com