Click to See Complete Forum and Search --> : Urgent - Printing a Form Without Using Printform method


bala_261175
April 18th, 2001, 03:22 AM
Hi,
I am in a Urgent need to solve a problem which has to get solved in a fast manner. I need u peoples' help.
My problem is, my client wants to print his forms thro our program itself. We gave him the option to print using the "form.Printform" method. But this is not printing properly in all the printers. Some printers is printing some junk characters instead of printing the form.
So is there is any other way usig API to solve this? I want a reply from u genltle and genius guys which is going to solve my problem.

Thanks in Advance

Regards
Bala

Clearcode
April 18th, 2001, 07:28 AM
Last month's "Developer of the month" code at http://www.visualbuilder.com is a print preview DLL (with source) that does exactly this.

HTH,
D.

-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com

shree
April 18th, 2001, 08:53 AM
Method 1:

Use the GetDC(GetDeskTopWindow()) API call combination to get the hDC of the desktop.
Use the SetWindowPos() to bring your window to the top.
Use GetClientRect() to find the coordinates of your window.
Use BitBlt() to copy this portion to a picturebox.
Finally, use Printer.Paintpicture to print the image on the picturebox.

Method 2:

Use SetWindowPos() to bring your window to the top.
Use SendKeys "%{PRTSC}" to send a Alt-PrintScreen combination that puts an image of the form with focus onto the clipboard. I'm not sure about this step though.
Use Clipboard.Getdata to paste this information onto a picturebox.
Finally, use Printer.Paintpicture to print the image on the picturebox.

bala_261175
April 18th, 2001, 10:34 AM
Hi,
Thanks for ur help and I tried the 2nd method. But i didn't get the picture in the clipboard itself. What could be the problem. I think that problem may be with the sendkeys.
If u can able to send the detailed code, that's is very use ful to me. I didn;t tried the 1st method since it has some more complicated functions than the 2nd one.
Regards
Bala

bala_261175
April 18th, 2001, 10:37 AM
Hi,
Since i didn't use that page, i struck with some complicated things. Where should I search the "Developer of the Month" in the specified Site.

Pl. help me out from this problem
Regards
Bala

Clearcode
April 18th, 2001, 10:46 AM
Oops - I gave you the wrong url.
Try http://www.freevbcode.com/ShowCode.Asp?ID=2428

HTH,
D

-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com