Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using ESCAPE with PASSTHROUGH
Message
 
 
À
15/02/2000 12:46:11
Calvin Smith
Wayne Reaves Computer Systems
Macon, Georgie, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00330602
Message ID:
00338210
Vues:
22
Calvin,

Sorry I didn't get back to you earlier on this. I've never tried mixing two printer streams like you are trying. IMHO if I'm going to use printer specific code anyway the whole process is better controlled by sending it all via ??? commands, instead of trying to "cooperate" along side the windows printer driver.

>I see what you are doing now - that will work if you are sending everything you are printing with ?? codes, but I am attempting to use either the report writer or SDE32. Here is the code I have been playing around with. I get a parameter incorrect error. As you can see I am trying to use Christof Lange's Structure class. I dont even know if I am doing that correctly.
>
>
>DECLARE INTEGER OpenPrinter IN WINSPOOL.DRV ;
> STRING pPrinterName, ;
> INTEGER @phPrinter, ;
> LONG pDefault
>
>*!* format of this function is hdc=CreateDC(.null.,printer name,.null.,.null.)
>*!* this creates a device context for the PAGE being printed
>DECLARE INTEGER CreateDC IN GDI32 ;
> STRING thedriver , ;
> STRING theprinter , ;
> INTEGER lpszoutput , ;
> INTEGER @lpinitdata
>
>*!* this should allow me to send printer control codes to the printer , am still working on the syntax for this command
>DECLARE INTEGER Escape IN GDI32 ;
> INTEGER hdc , ;
> INTEGER theescape , ;
> INTEGER nCOUNT , ;
> STRING lspdata , ;
> INTEGER oUTDATA ,
>
>LOCAL RESULT,PHANDLE,ESC_CODE,hdc,slen
>RESULT=0
>PHANDLE=0
>myprint=GETPRINTER()
>set classlib to STRUCT
>result=OpenPrinter(myprint,@pHANDLE,0)
>hdc=CreateDC(0,myprint,0,0)
>ostru=CreateObject("myesc")
>slen=ostru.sizeof()
>tstr=ostru.getstring()
>result=Escape(@hDC,19,slen,@tstr,0)
>=GetError()
>=DeleteDC(hdc)
>=ClosePrinter(phANDLE)
>
>define class myesc as STRUCT
> scode=chr(27)+chr(93)
> cmembers="pz:scode"
>enddefine
>*************************
>FUNCTION GetError
>parameter tnerror
>local lnError,IcError
>if Type('tnError')='N'
> lnError=tnError
>else
> lnError=GetLastError()
>endif
>
>lcError=space(255)
>FormatMessage(4096,0,lnError,0,@lcError,255,0)
>Messagebox('Error:'+alltrim(str(lnError))+chr(13)+chr(13)+lcError,16)
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform