we are now looking to declare API without using foxtools.fll. VFP crash not only when printing but when ouput is send to screen.
>Any luck with changing the printer driver??
>
>>We have vfp (version 5) application that use Crystal report. With Windows 95 report works fine but with Windows NT sometime VFP crash. We can launch the same report many time (four or five times, sometimes ten times) and Crystal do the job but suddently for the same report VFP crash with memory problem.
>>
>>Michel Poiré
>>
>>Here is the code we use
>>
>>SET LIBRARY TO &gcpathsystem.FOXTOOLS.FLL ADDITIVE
>>
>>*********************************
>>* Déclaration des fonction *
>>open_eng = REGFN32("PEOpenEngine","","I",gcpathsystem + "CRPE32.DLL")
>>open_job = REGFN32("PEOpenPrintJob","C","I", gcpathsystem + "CRPE32.DLL")
>>formu = REGFN32("PESetFormula","ICC","I", gcpathsystem + "CRPE32.DLL")
>>loc = REGFN32("crPESetNthTableLocation","IIC","I",gcpathsystem + "crwrap32.dll")
>>sousrap = REGFN32("PEOpenSubreport","IC","I",gcpathsystem + "CRPE32.DLL")
>>outpt_scr = REGFN32("PEOutputToWindow","ICIIIILI","I",gcpathsystem + "CRPE32.DLL")
>>outpt_prn = REGFN32("PEOutputToPrinter","II","I",gcpathsystem + "CRPE32.DLL")
>>sel_imp = REGFN32("PESelectPrinter","ICCCI","I",gcpathsystem + "crpe32.dll")
>>fenouv = REGFN32("PEGetWindowHandle","I","I",gcpathsystem + "CRPE32.DLL")
>>start_job = REGFN32("PEStartPrintJob","II","I",gcpathsystem + "CRPE32.DLL")
>>close_job = REGFN32("PEClosePrintJob","I","I",gcpathsystem + "CRPE32.DLL")
>>close_eng = REGFN32("PECloseEngine","","",gcpathsystem + "CRPE32.DLL")
>>print_ctrl = REGFN32("PEShowPrintControls","II","I",gcpathsystem + "CRPE32.DLL")
>>*********************************
>>
>>tmp_path = gcpathexec + "tmp\crystal.dbf"
>>if used("crystal")
>> use in crystal
>>endif
>>
>>use &tmp_path
>>
>>
>>* ******************************
>>* Lecture du nom du rapport
>>* ******************************
>>SCAN for alltrim(type) = "nomrap"
>> exit
>>ENDSCAN
>>
>>if eof()
>> =messagebox("Le nom et l'emplacement du rapport à imprimer n'a pas été spécifié.", 0, "Attention")
>> use in crystal
>> return 0
>>else
>> result = CALLFN(open_eng)
>> job = CALLFN(open_job,param1)
>>endif
>>
>>* ******************************
>>* Lecture de la destination
>>* ******************************
>>go top
>>SCAN for alltrim(type) = "destinat"
>> exit
>>ENDSCAN
>>
>>if eof()
>> dest = "0"
>>else
>> dest = alltrim(param1)
>>endif
>>
>>
>>* **************************************************
>>* Lecture des formules, rapports et sous rapport
>>* **************************************************
>>*set step on
>>go top
>>scan
>> do case
>> case alltrim(crystal.type) = "formule"
>> no_rec = recno()
>> this.conv_table(alltrim(param2))
>> goto no_rec
>> result = CALLFN(formu, job, alltrim(param1), alltrim(param2))
>> case alltrim(crystal.type) = "tab_loc"
>> no_rec = recno()
>> this.conv_table(alltrim(param2))
>> goto no_rec
>> result = CALLFN(loc, job, int(val(alltrim(param1))), alltrim(param2))
>> case alltrim(crystal.type) = "sousrap"
>> no_rec = recno()
>> this.conv_table(alltrim(param3))
>> goto no_rec
>> sousrapport = CALLFN(sousrap, job, alltrim(param1))
>> result = CALLFN(loc, sousrapport, int(val(alltrim(param2))), alltrim(param3))
>> endcase
>>endscan
>>
>>* *****************************************************************************
>>* Choix de la procedure a lancer dans crystal, dependamment de la destination
>>* *****************************************************************************
>>
>>* result = CALLFN(print_ctrl, job, 0) && Rend disponnible ou non la toolbar en preview
>>
>>do case
>> case lower(dest) = 'd'
>> result = CALLFN(outpt_scr, job, "Impression à l'écran", 1, 1, 640, 455, 0, 0)
>> otherwise
>> result = CALLFN(outpt_prn, job, 1)
>>endcase
>>
>>
>>* **************************************
>>* Lancement de la JOB d'impression
>>* **************************************
>>startresult = CALLFN(start_job, job, 1)
>>
>>
>>* ****************************************************************
>>* Boucle permettant de garder la fenetre de visualisation ouverte
>>* jusqu'a ce que l'usager la ferme
>>* ****************************************************************
>>do while CALLFN(fenouv, job) <> 0
>> WAIT "" TIMEOUT 1
>>enddo
>>
>>closed = CALLFN(close_job, job)
>>final = CALLFN(close_eng)
>>
>>release library &gcpathsystem.foxtools.fll
>>
>>use in crystal
Précédent
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