Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
GetPrinterDriver() problem
Message
De
24/08/2004 18:49:32
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00936149
Message ID:
00936167
Vues:
23
Sorry about that
DECLARE INTEGER GetPrinterDriver IN winspool.drv ;
	INTEGER, ;
	STRING, ;
	INTEGER, ;
	STRING, ;
	INTEGER, ;
	INTEGER
>It would be helpfull if you post your DECLARE for GetPrinterDriver.
>
>>The error returned from GetLastError() is
>>1780 = "A null reference pointer was passed to the stub."
>>
>>i have tried setting the second parameter to 'chr(0)' as specified in help ("...Pointer to a null-terminated string that specifies the environment (for example, "Windows NT x86", ...")
>>
>>but the result is the same. the function returns 0, and the bufferlength needed is not returned.
>>
>>
>>
>>>You've to check error generated by GetPrinterDriver to make sure that it's 'buffer too small error' not something else.
>>>* Get the size of the buffer required
>>>IF GetPrinterDriver(PrHandel, "", 1, "", 0, @RecvdBufferLen) = 0
>>>	IF GetLastError() <> 122   && The buffer too small error
>>>                *   Do something
>>>		RETURN .F.
>>>	ENDIF
>>>ENDIF
>>>
See Enumerating printer forms under Windows NT/2K/XP FAQ #22445 for how to handle API errors.
>>>
>>>>Why would the following not return the size need for the returned data (windows xp, Vfp 6 Sp5)? the printer is a network printer, but also installed on this machine. I am trying to get the name of the PrinterDrive installed for this printer.
>>>>PrHandel = 0
>>>>?OpenPrinter("\\print01\Plan1", @PrHandel, 0)
>>>>?PrHandel
>>>>
>>>>RecvdBufferLen	= 0
>>>>
>>>>?GetPrinterDriver(PrHandel, "", 1, "", 0, @RecvdBufferLen)
>>>>
>>>>Test		= space(RecvdBufferLen)
>>>>*EnvString		= "Windows XP"
>>>>EnvString		= ""
>>>>
>>>>?GetPrinterDriver(PrHandel, EnvString, 1, @Test, RecvdBufferLen, @RecvdBufferLen)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform