CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2000
    Location
    chennai,India
    Posts
    33

    Urgent - Printing a Form Without Using Printform method

    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


  2. #2
    Join Date
    Dec 1999
    Location
    Dublin, Ireland
    Posts
    1,173

    Re: Urgent - Printing a Form Without Using Printform method

    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
    '--8<-----------------------------------------
    NEW -The printer usage monitoring application
    '--8<------------------------------------------

  3. #3
    Join Date
    Mar 1999
    Location
    Nepal
    Posts
    540

    Re: Urgent - Printing a Form Without Using Printform method

    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.


  4. #4
    Join Date
    Dec 2000
    Location
    chennai,India
    Posts
    33

    Re: Urgent - Printing a Form Without Using Printform method

    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


  5. #5
    Join Date
    Dec 2000
    Location
    chennai,India
    Posts
    33

    Re: Urgent - Printing a Form Without Using Printform method

    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


  6. #6
    Join Date
    Dec 1999
    Location
    Dublin, Ireland
    Posts
    1,173

    Re: Urgent - Printing a Form Without Using Printform method

    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
    '--8<-----------------------------------------
    NEW -The printer usage monitoring application
    '--8<------------------------------------------

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured