|
-
Oct 28th, 2001, 05:44 PM
#1
Thread Starter
Junior Member
bitmap in a dll
How do I extract a bitmap in a .dll file and display it in a picture box? I can extract text but have been unable to do anything with a bitmap.
-
Oct 28th, 2001, 06:06 PM
#2
Which kind of DLL is it? ActiveX? or Standard?
-
Oct 28th, 2001, 06:13 PM
#3
PowerPoster
The ExtractIcon function retrieves the handle of an icon from the specified executable file, dynamic-link library (DLL), or icon file.
Example
VB Code:
'This project needs a PictureBox, called 'Picture1'
'In general section
Private Declare Function DrawIcon Lib "user32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal hIcon As Long) As Long
Private Declare Function ExtractIcon Lib "shell32.dll" Alias "ExtractIconA" (ByVal hInst As Long, ByVal lpszExeFileName As String, ByVal nIconIndex As Long) As Long
Private Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Private Sub Form_Load()
Dim Path As String, strSave As String
'Create a buffer string
strSave = String(200, Chr$(0))
'Get the windows directory and append '\REGEdit.exe' to it
Path = Left$(strSave, GetWindowsDirectory(strSave, Len(strSave))) + "\REGEdit.exe"
'No pictures
Picture1.Picture = LoadPicture()
'Set graphicmode to 'persistent
Picture1.AutoRedraw = True
'Extract the icon from REGEdit
return1& = ExtractIcon(Me.hWnd, Path, 2)
'Draw the icon on the form
return2& = DrawIcon(Picture1.hdc, 0, 0, return1&)
End Sub
-
Oct 28th, 2001, 06:32 PM
#4
Thread Starter
Junior Member
for megatron
it is a standard .dll file. And how do I specify which .dll I extract the bitmap from?
-
Oct 28th, 2001, 06:37 PM
#5
PowerPoster
in the example I gave above
-
Oct 28th, 2001, 06:44 PM
#6
Thread Starter
Junior Member
so i changed the path to the location of my dll, now no picture will show up.
-
Oct 28th, 2001, 07:01 PM
#7
PowerPoster
Did you change the icon index in ExtractIcon...
In the example it's 2, that will get the 3rd icon. if you only have 1 icon, set it to 0.
-
Oct 28th, 2001, 07:05 PM
#8
Thread Starter
Junior Member
ok, it works now, thanks. How can I apply this to bitmaps though...and, is there any way to load a new icon and replace the current one?
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
|