VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

Store and read a picture from memory.

MOhanand Sulaiman Abu Sall  (1 Submission)   Graphics   VB 6.0   Unknown Difficulty   Sat 21st September 2002   Mon 8th February 2021

Store and read a picture from memory.

API Declarations


Private Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hdc As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long

Public Function SetPictureIntoMemory(SrcPic As PictureBox, DestPic As PictureBox, Index As Byte)

BackUpSrcDC(Index) = CreateCompatibleDC(DestPic.hdc) 'Create DC to hold stage
BackUpResultDC(Index) = CreateCompatibleDC(DestPic.hdc) 'Create DC to hold stage
BackUphResultBmp(Index) = CreateCompatibleBitmap(DestPic.hdc, DestPic.ScaleWidth, DestPic.ScaleHeight)

'Select bitmap in DC
hSrcPrevBmp = SelectObject(BackUpSrcDC(Index), SrcPic.Picture) 'or put LoadPicture(Filename)
hDestPrevBmp = SelectObject(BackUpResultDC(Index), BackUphResultBmp(Index)) 'Select bitmap

End Function

Public Function CopyPictureFormMemory(SrcPic As PictureBox, SrcDc As Long)

SrcPic.AutoRedraw = True
BitBlt SrcPic.hdc, 0, 0, SrcPic.ScaleWidth, SrcPic.ScaleHeight, SrcDc, 0, 0, vbSrcCopy
SrcPic.Picture = SrcPic.Image
SrcPic.AutoRedraw = False

End Function


Rate Store and read a picture from memory. (1(1 Vote))
Store and read a picture from memory..bas

Store and read a picture from memory. Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters