Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to let the program choose a printer in a network ? 1

Status
Not open for further replies.

Cadeira

Programmer
Apr 7, 2008
13
BR
Dear colleagues:

The program bellow is working correctly if I choose the default printer, but if a choose another printer in the network, it doesn't obey ! It prints in the default printer !
What can be done for the program bellow to really obey the user choice (another network printer) ?

Please note: I am not using a report (.FRX)and do not intend to use it in this case.

Thanks,

Cadeira


* CAO.PRG

SET DEVICE TO SCREEN

ACTIVATE WINDOW TelaPadrao2
CLEAR


SET DEVICE TO PRINTER PROMPT


SET CONSOLE OFF
SET DEVICE TO PRINTER

PROCEDURE CABECFAT

SET COLOR TO RGB(0,0,0, 0,0,0), RGB(255,255,255, 255,255,255)

SET PRINTER OFF
SET PRINTER ON
SET PRINTER FONT 'Courier New' , 11
@11, 4 SAY EMPRDAD
@12,15 SAY YCNOME + " ("+LTRIM(STR(YCCODI))+")"
@13,15 SAY YCENDE

EJECT

SET PRINTER OFF
SET PRINTER TO DEFAULT
SET COLOR TO RGB(51,51,51, 204,204,204), RGB(0,0,0, 255,255,255)


DEACTIVATE WINDOW TelaPadrao2

RETURN
 
Hi Craig:

I'm using Visual FoxPro 9.

Thanks,
Cadeira
 
Code:
local lc_printer
lc_printer = getprinter()
if !isblank(lc_printer) && Escape pressed - cancel
  set printer to name &lc_printer.
endif

Andy Snyder
SnyAc Software Services Hyperware Inc. a division of AmTech Software
 
Ok Andy, I'll try the commands above.
But could anyone tell me why, the program doesn't obey the chosen printer in the window open with SET DEVICE TO PRINTER PROMPT command ?
It seems to be a bug in VFP 9 !
Thank you.
Cadeira
 
Probably because you're not using the normal printing interface when you are using @ say get.... those commands were only left in VFP for backwards compatibility.

If you really need to print directly to the printer you will have to use something like RAWPRINT.VCX or FLL in order to bypass the windows printer driver since all printing from VFP is done through the windows spooler.

Andy Snyder
SnyAc Software Services Hyperware Inc. a division of AmTech Software
 
Cadeira,

In fact I would say it's not responding whatever printer is chosen. It only appears to work when you choose the default printer because it's only using the default printer.

My only contribution is that after the line SET DEVICE TO PRINTER PROMPT you have the line SET DEVICE TO PRINTER.

I think the PROMPT keyword brings up the printer selection dialog.

Hope that helps,

Stewart
PS If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Yes Andy ! The code you provided worked fine in my program.

Mike Lewis: SET PRINTER TO GETPRINTER() just let me choose
the printer but it didn't send anything to the printer !

Thank you all,
Cadeira
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top