Solved

PrintWindow API Call ( VB 6.0 and 500 Points)

Posted on 2009-03-29
2
1,289 Views
Last Modified: 2013-11-25
I need to use the PrintWindow API Call to save a portion of a window to a picture box. I have done this so far ( see attached code). Any suggestions?
Dim Hwndwindow As Long
Hwndwindow = FindWindow(vbNullString, "Calculator")
Picture1.Visible = True
Picture1.AutoRedraw = True
Picture1.Picture = Nothing
PrintWindow Hwndwindow, Picture1.hDC, 0

Open in new window

0
Comment
Question by:KingSencat
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 2

Accepted Solution

by:
pathakhemant earned 500 total points
ID: 24016246
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 Command1_Click()
Dim Hwndwindow As Long
Hwndwindow = FindWindow(vbNullString, "Calculator")
Picture1.Visible = True
Picture1.AutoRedraw = True
Picture1.Picture = Nothing
PrintWindow Hwndwindow, Picture1.hDC, 0
End Sub
' OPEN CALCULATOR BEFORE PRESSING COMMAND1_CLICK
ITS WORKING

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question