|
Home > Archive > Programming with dBASE > November 2005 > Default printer name
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Default printer name
|
|
| Moses Hanna 2005-11-16, 7:23 am |
| Hi,
I have a server and 3 workstations
each workstation has its own printer, but the other two printers are shared.
Any workstation could have any printer as his default.
I want to get the name of the default printer for any workstation from
within a program.
_app.printer.printername returns "" for the default printer name, but in
actual fact it has a name.
How can I get that name.
Any assistance?
Thanks
Moses
| |
| David Stone 2005-11-17, 8:23 pm |
| Moses Hanna wrote:
> I have a server and 3 workstations
> each workstation has its own printer, but the other two printers are shared.
> Any workstation could have any printer as his default.
> I want to get the name of the default printer for any workstation from
> within a program.
> _app.printer.printername returns "" for the default printer name, but in
> actual fact it has a name.
> How can I get that name.
> Any assistance?
Moses, here's a function posted by Romain long long ago:
Function GetDefaultPrinter
local cSection,cBuffer,cEn
try
if type(" GetPrivateProfileStr
ing") <> "FP"
extern CLONG GetPrivateProfileStr
ing( CSTRING,;
CSTRING,;
CSTRING,;
CSTRING,;
CLONG,;
CSTRING ) ;
kernel32 from " GetPrivateProfileStr
ingA"
endif
cSection="windows"
cEntry="device"
local cBuffer, cDefault, cIniFile
store space(128) to cBuffer
GetPrivateprofileStr
ing(cSection, cEntry, "",;
cBuffer,len(cBuffer)
, "WIN.INI")
return trim(cBuffer)
| |
| Moses Hanna 2005-11-18, 3:23 am |
| Thanks David, It works just fine
"David Stone" <dlstone@wholegrain.com> wrote in message
news:437D188A.90F77E6D@wholegrain.com...
> Moses Hanna wrote:
>
>
> Moses, here's a function posted by Romain long long ago:
>
> Function GetDefaultPrinter
> local cSection,cBuffer,cEn
try
> if type(" GetPrivateProfileStr
ing") <> "FP"
> extern CLONG GetPrivateProfileStr
ing( CSTRING,;
> CSTRING,;
> CSTRING,;
> CSTRING,;
> CLONG,;
> CSTRING ) ;
> kernel32 from " GetPrivateProfileStr
ingA"
> endif
> cSection="windows"
> cEntry="device"
> local cBuffer, cDefault, cIniFile
> store space(128) to cBuffer
> GetPrivateprofileStr
ing(cSection, cEntry, "",;
> cBuffer,len(cBuffer)
, "WIN.INI")
> return trim(cBuffer)
>
| |
| David Stone 2005-11-18, 11:23 am |
| Moses Hanna wrote:
> Thanks David, It works just fine
You're welcome, and thanks for the success report.
David
|
|
|
|
|