Solved

save my own picture in file

Posted on 2001-06-11
4
156 Views
Last Modified: 2010-05-02
hi
as you know we can use BitBlt function to get capture from Dc to other Dc.
how i can save the new image whitch i capture it , to the file.
for examp:
Myret=bitblt(picture1.hdc,0,0,100,100,getdc(0),0,0,DropFlag)

when i write

SavePicture Picture1.Picture, "c:\mypic.bmp"

compiler say
thier is no picture

0
Comment
Question by:issamtaher
  • 3
4 Comments
 
LVL 38

Accepted Solution

by:
PaulHews earned 100 total points
ID: 6178864
Option Explicit
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long

Private Sub Command1_Click()
    Dim myret As Long
    Picture1.AutoRedraw = True
    myret = BitBlt(Picture1.hDC, 0, 0, 100, 100, GetDC(0), 0, 0, vbSrcCopy)
    Debug.Print myret
    Picture1.Refresh
    SavePicture Picture1.Image, "C:\windows\desktop\test.bmp"
End Sub

0
 
LVL 38

Expert Comment

by:PaulHews
ID: 6178911
The AutoRedraw is the important thing here.  It creates a persistent memory bitmap (necessary for valid picture object) when drawing operations are performed on the DC.
0
 
LVL 1

Author Comment

by:issamtaher
ID: 6178914
thank you for heilping me
yours issam taher
0
 
LVL 38

Expert Comment

by:PaulHews
ID: 6178940
You're welcome
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
String manipulation in Visual Basic 7 58
Put text in a picture ASP.NET C# 2 50
Hide vba in gp 7 80
How to hault or freeze parent form when a 2d form is open in vb6 3 35
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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…
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…

932 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

13 Experts available now in Live!

Get 1:1 Help Now