Solved

PrintWindow API Call ( VB 6.0 and 500 Points)

Posted on 2009-03-29
2
1,285 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

Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

737 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