Solved

save my own picture in file

Posted on 2001-06-11
4
177 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
[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
  • 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
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…

726 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