Ok, the problem is easily reproducible.
In the Load of the form put SET PRINTER TO DEFAULT
Then in command button
=messagebox("Windows Default Printer: " + set("Printer",2))
=messagebox("VFP default printer: " + set("Printer",3))
In other words, VFP default printer is not changing that you change Windows default printer.
I guess we can do BindEvent somehow. I would expect it to be quite difficult task.
May be you can have alternative solution?
>Hi Gregorio,
>
>I understood the problem. I'll try to reproduce.
>My second suggestion was to get the windows default printer and you would probably have to set printer to this name. Doesn't sound like a good solution.
>
>I would expect VFP to always recognize default printer correctly.
>
>Let me try some test.
>
>UPDATE. I created a form with command button:
>=messagebox(set("Printer",2))
>
>When I change my printer from Fax & Printers dialog in Control Panel, this messagebox shows information correctly.
>
>What is your VFP default printer?
>PRINTER, 1
> FileName or PortName
>
>PRINTER, 2
> Default Windows printer name
>
>PRINTER, 3
> Default Visual FoxPro printer name(specified in the Visual FoxPro Print or Print Setup dialog boxes)
>
>
>>Naomi:
>>
>>That code is changing the system default printer but did not change the Visual foxpro default printer. Look like we are not in the same page. I changed manually the default printer using windows while my application is running. When I switch to the appllication and go to print a report and invoke the printer setup from visual foxpro it show my original printer as my default instead of the one that I just changed.
If it's not broken, fix it until it is.
My Blog