Solved

PrintWindow API Call ( VB 6.0 and 500 Points)

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

Accepted Solution

by:
pathakhemant earned 500 total points
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

763 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now