|
-
Jun 18th, 2001, 04:41 AM
#1
Thread Starter
New Member
BitBlt from Resource File
I want be bitblt stuff from bitmaps located in a resource file. As far as I know, the bitmaps are STDPICTUREs. However, bitblt only deals with DCs.
How do I make a DC for the picture in the resource file?
What's the deal with DC's anyway (I know they stand for device context, whatever that means)?
-
Jun 18th, 2001, 05:11 AM
#2
PowerPoster
You dont make the DC - you get it. The DC is a reference to that surface, like a link to a site .
Now to your problem:
I dont know if resource bitmaps are of StdPicture, but the following function will load IPictureDisp -pictures and get the DC, maybe it will work with StdPics too 
Code:
Function LoadDC(iFileName As String) As Long
Dim DC As Long
Dim Temp As IPictureDisp 'Change to StdPicture
'Create compatible DC
DC = CreateCompatibleDC(frmMain.hdc)
'Error: Can't create compatible DC
If DC < 1 Then: Exit Function
'Load bitmap
Set Temp = LoadPicture(iFileName) 'Put your bitmap resource here
SelectObject DC, Temp
'Apply values
LoadDC = DC
'In case you need the Size
'w = frmMain.ScaleX(Temp.Width)
'h = frmMain.ScaleY(Temp.Height)
'Release memory
DeleteObject Temp
Set Temp = Nothing
End Function
-
Jun 18th, 2001, 06:25 AM
#3
Addicted Member
The Above code will work fine with resource files, I have used them myself with the same code, all you need to do is to replace:
Set Temp = LoadPicture(iFileName) 'Put your bitmap resource here
with:
Set Temp = LoadResPicture(indexNo)
Some Days, i just get this feeling that i'm helping to write dozens of Viruses...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|