Hola guys, I've been dwelving in books, ebooks, tuts and source codes for the last 2 days.. Printing is more or less good described all over the place.. Thanks to Petzold & Company. But I'm missing the Print Preview Feature.. As the logical units change should I just go ahead and count all the stuff by myself or is there a more decent (easy) way around to display a correct Print Preview? All sources I found were in VB or such.. :( TIA, JimmyClif PS: If anyone got some great C boomarks btw please post them too.
Posted on 2001-06-21 01:31:00 by JimmyClif
This is what I'm using:

	invoke GetPrinterDC		; Get Printer Paper Size	; No parameters reqd
	mov	hdcPrn,eax

	.if eax==0
	    mov    eax,0
	    ret
	.endif

	invoke	GetDeviceCaps, hdcPrn, HORZRES;Width, in pixels, of the screen.
	mov	x_PrnPageSize,eax

	invoke	GetDeviceCaps, hdcPrn, VERTRES;Height, in raster lines, of the screen.
	mov	y_PrnPageSize,eax

	invoke	StartDoc, hdcPrn, ADDR doci	;Points to a DOCINFO structure containing 
						;the name of the document file and the 
						;name of the output file.
Hope this will help a bit.
Posted on 2001-06-21 02:41:00 by forge
forge, Thanks for taking the time... but isn't this only for printing? Or will the Name of the output file be a converted file usable as Print Preview? I haven't thought about this possibility.. I'll just give it a go ;) JimmyClif This message was edited by JimmyClif, on 6/22/2001 9:26:40 AM
Posted on 2001-06-21 14:52:00 by JimmyClif
JimmyClif It is for printing, but: As you have the size of your paper you can fill this HDC with text, lines etc. and send it to the printer or display it first in a new window on your screen and call it (print preview window). Naturally the preview window can be scalled to any size you want. You can call it WYSWYG if you like. It reflect, what will be printed. I didn't find any shortcut to make it easier. forge
Posted on 2001-06-21 20:08:00 by forge
Thanks a lot forge... It worked out good painting the PrinterDC and displaying it... Having finally finished I assume that it will never get used anyway as it looks more or less like the screen itself.. *hehehe* DOH... Oh.. well.. I learned a lot in a night tho... I can finally take off for the sun now ;) JimmyClif
Posted on 2001-06-22 02:07:00 by JimmyClif
forge,

   .if eax==0
       mov    eax,0 ; ?!  Why? U can delete this row..
       ret
   .endif
Posted on 2001-06-22 09:55:00 by buliaNaza
My deep apology. My flow of thinking was: if error mov eax,0 ret In this case the error happen to be zero and I did overlook this mov eax,0 , but I'm not going back to say NOP NOP as this few clocks wouldn't make any difference. Thanks anyway for picking for me this unnecessary code. forge
Posted on 2001-06-22 10:31:00 by forge