Solved

save my own picture in file

Posted on 2001-06-11
4
152 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
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…

706 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

17 Experts available now in Live!

Get 1:1 Help Now