Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Remove Windows Printer
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00420415
Message ID:
00421505
Vues:
12
Denis,

I figured out what the problem is. The OpenPrinter() function's third parameter is to a PRINTER_DEFAULTS structure. In my example, I set this to a null pointer, which is allowable. However, under NT/Win2K, this structure needs to be passed with one of the members set appropriately to allow you to accomplish this. This structure does require the use of embedded pointers. The best I can help you with is the following:

What follows is the C type declaration for the structure, followed by a pseudo-VFP equivalent. IOW, I'm using VFP syntax to define the structure but you can't do it in VFP
// C Declaration
typedef struct _PRINTER_DEFAULTS { 
  LPTSTR      pDatatype; 
  LPDEVMODE   pDevMode; 
  ACCESS_MASK DesiredAccess; 
} PRINTER_DEFAULTS, *PPRINTER_DEFAULTS;
* Pseudo-VFP equalivalent
DEFINE TYPE
  STRING @pDatatype
  STRING @pDevMode
  INTEGER DesiredAccess
ENDDEFINE
It's the DesiredAcess member that's the problem. From my reading of the docs it needs to be set to PRINTER_ALL_ACCESS (0x000F000C). What you can do is pass the following string by reference instead of 0 as the third parameter to OpenPrinter(). REPLICATE(CHR(0), 8) + CHR(12) + CHR(0) + CHR(15) + CHR(0).

Try this and let me know if it works.
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform