Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Set Default Printer ?
Message
De
07/09/2001 22:19:04
 
 
À
07/09/2001 13:34:16
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00553536
Message ID:
00554210
Vues:
23
>Although I found documentation on ShellExecute in the Platform SDK on-line resources, I still can't get the PrintTo to work. (This verb is listed as an action in the registry for the application that is responsible for handling TIFs. I'm just using the app that comes with windows, "Imaging for Windows" by Kodak.) First, I'm assuming that the PrintTo verb prints a document file to a printer. Is this correct? If so, I don't know how to specify the printer name in the call to ShellExecute. Heres how I call the ShellExecute.
>

Yes; depending on the implementation, it either accepts the name of a Windows Printer known to the system, or triggers the Printer Selection Common Dialog. The syntax for any given server probably variesfrom server app to server app; as it is a common verb, it was strongly likey to be implemented, but exactly how the call is meant to get parameters will require a look at the server application's docs to find.

>DECLARE INTEGER ShellExecute ;
> IN SHELL32.DLL ;
> INTEGER nWinHandle,;
> STRING cOperation,;
> STRING cFileName,;
> STRING cParameters,;
> STRING cDirectory,;
> INTEGER nShowWindow
>
>shellexecute(0,'printto','MyImage.TIF','MyPrinter','',0)
>
>I am guessing that I specify the name of the printer with the cParameters argument, but, since it didn't work, I must be wrong.
>

It may need some keyword or command line switch to be sent, identifying the parameter as the printer name. RTFM. < g >

>>>It actually worked under win98.
>>>
>>>A problem though...
>>>
>>>The reason I need to set the Win printer (and not just the default vfp printer) is because I'm trying to print a .TIF by using the ShellExecute Win api function. This function works, but of course, sends output to the default windows printer - regardless of what VFP says is the default printer.
>>>
>>>So, I expected the TIF to be printed to my new printer after issuing the oNet.SetDefaultPrinter, but it still prints to the old one even tho the calls to oNet.SetDefaultPrinter seemed to work. (I even checked the values of SET('PRINTER',2) and SET('PRINTER',3) to verify that it worked. But still, the TIF printed to the old printer.
>>
>>You need to invoke the 'PRINTTO' OLE action rather than the 'PRINT' action via ShellExecute() - see the docs on ShellExecute() in the MSDN Platform SDK in the MSDN Library, also available on-line through the Platform SDK reference materials at MSDN OnLine, available through msdn.microsoft.com
>>
>>Your current OLE Serve assigned to handle .TIF files may not support the 'PRINTTO' verb; you can check this through Windows Explorer (or directly by examining the shell extensions in HKEY_CLASSES_ROOT associated with the CLSID of the OLE Server identified in HKEY_CLASSES_ROOT\.tif)
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform