CodeItBetter Programming Another VB Programming Blog

How to Load a picture from a resource into a hDc

Posted on January 5, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
'Graphics - How to Load a picture from a resource into a hDc
Option Explicit
 
Public Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long
Public Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
 
Private Function LoadPicFromResource(ID As Integer) As Long
    Dim hdcSrc As Long
    hdcSrc = CreateCompatibleDC(hdc)
    SelectObject hdcSrc, LoadResPicture(ID, vbResBitmap)
    LoadPicFromResource = hdcSrc
End Function
 
'How can I use this function:
picHDc = LoadPicFromResource(101)
Filed under: Graphics Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.