Hi all
I've got some code which uses the set default printer windows API call.
This correctly changes the printer in the control panel printers applet
and the printer I've selected has a tick against it.
However if I either shellexecute print of any document or just right
click print from Windows explorer the output still goes to the original
default printer and not the one I've just set default to.
It's as though the change has been made but not applied or flushed in
some way.
This fails on both XP and Vista.
The test application I've written just has a combobox with printers
listed populated by aprinters.
In the interactive change event
m.printer=thisform.PrinterCombo.value
set printer to name (m.printer)
If !("98" $ Os()) && 98 evidently doesn't have the API.
Declare Long GetLastError In WIN32API
Declare Long SetDefaultPrinter In WINSPOOL.DRV String
pPrinterName
nStat=SetDefaultPrinter(m.printer)
If nStat != 0
Wait Clear
Endif
Endif
There is a print commandbutton which asks for the file to print which is
a pdf and does a simple shellexecute to do the print.
cParameters="SW_SHOWMINNOACTIVE"
Declare Integer ShellExecute IN SHELL32.Dll INTEGER nWinHandle, STRING
cOperation, STRING cFileName, STRING cParameters, STRING
cDirectory,INTEGER nShowWindow
ShellExecute(0, "Print", Alltrim(cnewName), "", "", 2) && where
cNewName is the full path to a pdf in this instance.
Does anyone have any ideas please.
Regards
Graham
--- StripMime Report -- processed MIME parts ---
multipart/alternative
text/plain (text body -- kept)
text/html
---
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.