Information générale
Catégorie:
Fonctions Windows API
Dear Christof,
I downloaded Struct.Zip.
It's really useful but I still have some problems in using it.
My knowledge in C and API functions is poor.
I created a report generator for VFP's reports
to be used in an application to generate users new reports
and I need to get info about installed printers, get the dialog box
and get back information abot new settings of the printer.
In the above program I expect that "SetPointer"
fills the DevMode structure with info about my printer.
The debugger shows empty values.
What do I do wrong ?
Thanks in advance
Razvan & Catalina
???????????
Set ClassLib to Struct, WinStruct Additive
#include apidef.h
Do ApiDef
Declare Integer DocumentProperties in WinSpool.Drv as WS_DocumentProperties ;
Integer hWnd, ;
Integer hPrinter, ;
String pDeviceName, ;
Integer pDevModeOutput, ;
Integer pDevModeInput, ;
Integer fMode
Local loDevMode, hWnd, hPrinter, pDeviceName, pDevModeOutput, pDevModeInput, fMode
loDevMode = CreateObject("DEVMODE")
hWnd = 0
hPrinter = 0
pDeviceName = "HP DeskJet 660C"
pDevModeOutput = 0
pDevModeInput = 0
fMode = 0
= WS_OpenPrinter(pDeviceName, @hPrinter, NULL)
lnSizeInBytes = WS_DocumentProperties( ;
hWnd, ;
hPrinter, ;
pDeviceName, ;
pDevModeInput, ;
pDevModeOutput, ;
fMode)
lnPointer = loDevMode.GetPointer( lnSizeInBytes )
fMode = 4
pDevModeOutput = lnPointer
= WS_DocumentProperties( ;
hWnd, ;
hPrinter, ;
pDeviceName, ;
pDevModeInput, ;
pDevModeOutput, ;
fMode)
loDevMode.SetPointer( lnPointer )
loDevMode.FreePointer( lnPointer )
WS_ClosePrinter( m.lnHandle )
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement