>This is related to the other thread (thread #
1154292 part II).
>
>After googling it out for numerous hours, I still don't see the connection between the dialog ActiveX object, the host it runs for, and how to get the user selection from it. The only way I found to retrieve something from it is to set it to keep the hDC of the selected printer, but then I can't find a way to find the printer name from hDC. Michel's restriction on keywords in search is partially to blame, "printer from hdc" won't work, "from" is a keyword, and "printer hdc" gives me all the myriad messages about printing from RTF control :).
>
>So, question #1: how do I get the printer properties from the hDC? I may just let the dialog set the windows default printer (as the printer doesn't change for VFP if I don't) and then restore it when I'm done, but that's ugly.
>
>Question #2: how can I filter out the printers it shows? It shows ALL the printers, and I want to kick out any of them that have "PDF" in the name. Or at least can I have a dialog that shows the printer setup for just one given printer name, without the ability to select a printer? Then I'd have a combo with a (filtered) selection elsewhere.
Hi Dragan,
If you only want to prevent printing to file then you can just give the flag cdlPD_HIDEPRINTTOFILE
#Define cdlPD_HIDEPRINTTOFILE 0x00100000
oCommDialog.Flags = cdlPD_ALLPAGES + cdlPD_HIDEPRINTTOFILE + cdlPD_RETURNDC
oCommDialog.ShowPrinter()
However, as you probably know, that ShowPrinter() from CommDialog ActiveX is limited. So, if you want to get the selected printer name than you will have to use PrintDlg() API
About filtering the Printer Name, I can think of the solution, but it's kind of ugly <*bg*>. Just let me know if you are interesting. I'll work on it and post it here or mail it to you
Regards
Herman