Results 1 to 2 of 2

Thread: Print Screen

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2002
    Location
    surrey
    Posts
    10

    Print Screen

    I have a requirement do screen prints in my Project. Is there an API call that will allow me to do this ?

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    VB Code:
    1. Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
    2. Private Const VK_MENU As Byte = &H12
    3. Private Const VK_SNAPSHOT As Byte = &H2C
    4. Private Const KEYEVENTF_KEYUP = &H2
    5.  
    6. Private Sub cmdPrintForm_Click()
    7. Dim lWidth As Long, lHeight As Long
    8.     Clipboard.Clear
    9.     Call keybd_event(VK_MENU, 0, 0, 0)
    10.     Call keybd_event(VK_SNAPSHOT, 0, 0, 0)
    11.     DoEvents
    12.     Call keybd_event(VK_SNAPSHOT, 0, KEYEVENTF_KEYUP, 0)
    13.     Call keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, 0)
    14.     Printer.Print
    15.     If Width > Printer.ScaleWidth Then
    16.         lWidth = Printer.ScaleWidth
    17.         lHeight = (Printer.ScaleWidth / Width) * Height
    18.     Else
    19.         lWidth = Width
    20.         lHeight = Height
    21.     End If
    22.     Printer.PaintPicture Clipboard.GetData, 0, 0, lWidth, lHeight
    23.     Printer.EndDoc
    24. End Sub
    25. 'PrintForm
    26. 'To print the form using Ctrl-P
    27. Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    28.     'KeyPreview must be set to True
    29.     If (Shift And vbCtrlMask) = vbCtrlMask And KeyCode = vbKeyP Then
    30.         cmdPrintForm_Click
    31.     End If
    32. End Sub

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