Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need to get and set windows default printer
Message
From
27/11/2006 18:29:29
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
27/11/2006 18:22:24
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01172779
Message ID:
01172790
Views:
16
>>>We are doing a Fox 2.0 DOS to VFP9 conversion. There are more reports than you can shake a stick at. They are written using ?? and ? to send raw data to the printer. I have been able to get this to work with the default printer but need to be able to get the current default printer, set the default to a printer for wide column reports and then set it back to the original default.
>>>
>>>Has anyone done this?
>>>
>>>Thanks Jeff
>>
>>Instead of setting the Windows default printer (which will affect other applications), you might simply SET PRINTER TO NAME ...
>>
>>This will change the printer for the VFP application, until you exit the application.
>
>The problem is that using ?? and ? will only output to the default printer. I have tried setting printer to name printername, printername and getprinter(). None of these work with ?? and ? unless it is the default printer.
>
>thanks, jeff

Hmm, I usually send information with "???". I suggest the following approach:
  • Create a text file - I'll call it "output.txt" in the sample code below - with whatever means. For compatibility with your existing system, this would probably be "?" and "??"; output can be redirected with SET CONSOLE OFF / SET ALTERNATE ON / SET ALTERNATE TO ...
  • Use the following commands to send the output to the printer:
    set printer to name...
    lcPrinterCodes
    lcFileInRam = FileToStr("output.txt")
    ??? lcPrinterCodes + lcFileInRam
    Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
  • Previous
    Next
    Reply
    Map
    View

    Click here to load this message in the networking platform