Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
4
Erster Beitrag:
vor 4 Jahren, 9 Monaten
Letzter Beitrag:
vor 4 Jahren, 9 Monaten
Beteiligte Autoren:
jeff, Marc De Swert, DarrenF

[WD14] How can I print the contents of the current window?

Startbeitrag von jeff am 14.10.2013 03:13

Is there a relatively straightforward way to print the current window (as in print to a printer, not a screen capture or something along those lines)? I haven't had much luck finding useful-looking methods when looking through the help documents. I'd greatly appreciate any suggestions!

Thanks,
Jeff

Antworten:

Hi Jeff,

I've not tested it, but you could try to use the WindowBitmap function:
http://doc.pcsoft.fr/en-US/?3038013&name=windowbitmap_function&q=windowbitmap&verdisp=180

...and then use iPrintImage:
http://doc.pcsoft.fr/en-US/?3046017&name=iprintimage_function&q=Print

von DarrenF - am 14.10.2013 07:35
Thanks for the response and suggestion. I came up with the following, but it seems to fail with a Windows GPF (see below) when it hits the WindowBitmap function. Unfortunately, my support from WinDev has elapsed, so I can't get anything from them. Has anyone run into similarly vague issues when using WindowBitmap? I suspected UAC issues, but I would think a user would have access to write to the local app data folder. Any ideas?


fileName is string = SysDir(srLocalAppData) + "\printScreenImage"
fileNameWithExt is string = fileName + ".bmp"
imageCount is int = WindowBitmap(myWindow, fileName)
IF imageCount = 1 THEN
IF fFileExist(fileNameWithExt) THEN
iPrintImage(fileNameWithExt, 0, 0, iPageWidth(), iPageHeight(), iHomoCenteredDisplay)
iEndPrinting()
END
END


- WL Call:
Processing , line , thread
- Level: fatal error (EL_FATAL)
- Error Code: 1020
- WD55 Error Code: 0
- No system error code
- No system error message

- What happened?
Unexpected system error.
If this error systematically occurs in the same conditions, contact PC SOFT Hot Line and specify:
- the error circumstances,
- a window, a project or the code lines used to replicate the problem,
- the details below.

Détails techniques :
Module : WD140OBJ.DLL
Version du module : 14.00Oqe
VI : 01A140030f
Adresse de base : 25060000
Erreur système : Access violation (GPF)
EIP = 25147A4B
OS : Windows Longhorn Service Pack 1(6.1.7601)

- Debug Information:
Détails techniques :
Module : WD140OBJ.DLL
Version du module : 14.00Oqe
VI : 01A140030f
Adresse de base : 25060000
Erreur système : Access violation (GPF)
EIP = 25147A4B
OS : Windows Longhorn Service Pack 1(6.1.7601)
Registres :

EIP = 25147A4B EBP = 0018E044
EAX = 0018E018 EBX = 0018E038
ECX = 00000028 EDX = 0018E018
ESI = 0018E018 EDI = 00000000

Pile des appels :

[WD140OBJ.DLL (25060000), 14.00Oqe, 01A140030f] 25117852 : onXAMLEvent() + 197113 bytes
[WD140OBJ.DLL (25060000), 14.00Oqe, 01A140030f] 25117852 : onXAMLEvent() + 204137 bytes
[WD140VM.DLL (25E60000), 14.00Qs, 01A140030f] 25E78CB0 : TermLibrary() + 112098 bytes
[WD140VM.DLL (25E60000), 14.00Qs, 01A140030f] 25FA1110 : DeclareProxy() + 307480 bytes
[WD140VM.DLL (25E60000), 14.00Qs, 01A140030f] 25E78CB0 : TermLibrary() + 43680 bytes
[WD140VM.DLL (25E60000), 14.00Qs, 01A140030f] 25ED5980 : nConversionDepassementEx() + 194896 bytes
[WD140VM.DLL (25E60000), 14.00Qs, 01A140030f] 25E78CB0 : TermLibrary() + 2848 bytes
[WD140VM.DLL (25E60000), 14.00Qs, 01A140030f] 25E78CB0 : TermLibrary() + 2848 bytes
[WD140VM.DLL (25E60000), 14.00Qs, 01A140030f] 25E78CB0 : TermLibrary() + 2848 bytes
[WD140VM.DLL (25E60000), 14.00Qs, 01A140030f] 25E78CB0 : TermLibrary() + 51232 bytes
[WD140VM.DLL (25E60000), 14.00Qs, 01A140030f] 25E78CB0 : TermLibrary() + 51168 bytes
[WD140VM.DLL (25E60000), 14.00Qs, 01A140030f] 25E78CB0 : TermLibrary() + 49376 bytes
[WD140VM.DLL (25E60000), 14.00Qs, 01A140030f] 25E78CB0 : TermLibrary() + 49584 bytes
[WD140VM.DLL (25E60000), 14.00Qs, 01A140030f] 25E78CB0 : TermLibrary() + 49424 bytes
[WD140VM.DLL (25E60000), 14.00Qs, 01A140030f] 25E78CB0 : TermLibrary() + 49600 bytes
[WD140VM.DLL (25E60000), 14.00Qs, 01A140030f] 25E78CB0 : TermLibrary() + 49760 bytes
[WD140VM.DLL (25E60000), 14.00Qs, 01A140030f] 25E78CB0 : TermLibrary() + 50032 bytes
[WD140VM.DLL (25E60000), 14.00Qs, 01A140030f] 25E78CB0 : TermLibrary() + 50544 bytes
[WD140VM.DLL (25E60000), 14.00Qs, 01A140030f] 25E78CB0 : TermLibrary() + 49680 bytes
[WD140VM.DLL (25E60000), 14.00Qs, 01A140030f] 25E78CB0 : TermLibrary() + 50560 bytes
[WD140VM.DLL (25E60000), 14.00Qs, 01A140030f] 25E78CB0 : TermLibrary() + 149840 bytes

von jeff - am 16.10.2013 03:21
hi jeff,
my post from a few years back:


we use an global procedure
create an global variable:
bestand is string = "i:\fenetre.bmp" // here will the picture be saved c:\temp also do
when an user want to do a certain process we capture first an screen printout

IF bPrint = 1 THEN
CAPTUREECRAN(bestand)
iPrintImage(bestand,20,20,174,151)
iEndPrinting
END

the global procedure
PROCEDURE CAPTUREECRAN(NomBMP)
NomDest is string // Nom du champ image destination

// Initialisation des paramètres
NomDest="screendump" // Champ image qui sert pour la sauvegarde

// Initialise la taille du champ destination à la taille de la zone à copier
{NomDest}..Width=WinInWidth()
{NomDest}..Height=WinInHeight()
dCopyBlt(copyScreen,NomDest,copySrcCopy,WinInXPos(),WinInYPos(),WinInHeight()+2,WinInWidth()+2)

// Sauvegarde au format BMP
dSaveImageBMP(NomDest,NomBMP)
dEndDrawing(NomDest) // Libère la taille prise en mémoire

marc :cool:

von Marc De Swert - am 16.10.2013 06:18
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.