Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 5 of 5

Thread: Print Screen

  1. #1
    Join Date
    Dec 2003
    Posts
    13

    Grin Print Screen

    I'm wanting to "Print Screen" within AutoPlay. I have tried playing with javascript window.print in several places but no luck.

    I want the project will have a button that says "print this page". When the user clicks it, their print dialog box pops up, they select the printer and click print and a screen capture is sent to their printer.

    I've seen ways of doing this by having a screen capture saved as a .jpg and telling the program to print that but there must be an easier way. There are many pages with info and I'd rather let the user print what he wants instead of setting up all of those commands.

    Any help would be great. Thank you!

  2. #2
    Join Date
    Sep 2002
    Location
    Sol 3
    Posts
    3,160
    Is there something specific on the page that you are trying to print, like a web object or a paragraph object? There are two actions in AMS for printing, File.Print and Web.Print, these are the built in options. You can always grab the information from a paragraph object and write it to a text file in _TempFolder and print that particular file, or if you have a web object you can print that directly. Is it possible that you could duplicate your page as an html page, or use a web object to hold the information, that would solve your printing needs.

    If you are on Win XP or later, the User32.dll has a PrintWindow function. Here is the description:


    The PrintWindow function copies a visual window into the specified device context (DC), typically a printer DC.

    I don't know how to call the functions from the dll yet, but some of the programmers here, like Worm, may be able to help in that departmenth.

    Tigg

    EDIT
    BTW here is the example from the API guide, the red portion is what you would probably call from AMS, and it looks like you would need to get the window handle for the AMS window.

    Code:
    Private Declare Function PrintWindow Lib "user32" (ByVal hWnd As Long, ByVal hdcBlt As Long, ByVal nFlags As Long) As Long
    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    Private Sub Form_Load()
        'KPD-Team 2001
        'URL: http://www.allapi.net/
        'E-Mail: KPDTeam@Allapi.net
        Dim mWnd As Long
        'launch notepad
        Shell "notepad.exe", vbNormalNoFocus
        DoEvents
        'set the graphics mode to persistent
        Me.AutoRedraw = True
        'search the handle of the notepad window
        mWnd = FindWindow("Notepad", vbNullString)
        If mWnd = 0 Then
            Me.Print "NotePad window not found!"
        Else
            'draw the image of the notepad window on our form
            PrintWindow mWnd, Me.hDC, 0
        End If
    End Sub
    Last edited by TJ_Tigger; 12-18-2003 at 08:42 AM.

  3. #3
    Join Date
    Dec 2003
    Posts
    13
    Thanks for responding. And very fast, I might add.

    No, there is nothing specific I wish to print. Just what appears on the screen.

    When you hit "Print Screen" on your keyboard, open something like PhotoShop and select New from clipboard you see the screen capture. That's what I want to print. It would stand to reason that just hitting Print Sceen would send the image to your printer and not the clipboard but I know that's not how it works.

    I guess that's what I'm asking. How do I write a command that will take a screen capture (print screen) and send that to my printer.

    The user gets a print out of exactly what he/she sees on the screen.

    Thanks

  4. #4
    Join Date
    Sep 2002
    Location
    Sol 3
    Posts
    3,160
    If the page is static (not changing) you could take a screen capture and store it in your project, then have a button on the page that states [print screen] that will then print the image file. Of course this will only work if the items on your page do not change.

  5. #5
    Join Date
    Dec 2003
    Posts
    13
    I've thought of that. Two reasons I'd like a work around are I'd have to do all the pages that way if I wanted them to be able to print any page they'd like and what if the info isn't static? Input boxes that have replies popping up or user controled flashes.

    Surely there's a way to print a screen capture. I keep going back to JavaScript since that would make since but I can't find anything.

    Any other ideas?
    Thanks

Posting Permissions

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