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 |