|
-
Jun 6th, 2003, 02:13 PM
#1
Thread Starter
Hyperactive Member
Get at project's icon at runtime?
Is there a way I can get at the project's icon, the one set in Project - Properties - Make - Application ...
at run time?
What I want to do is load an Image control, e.g. right now I can do an
image1.Picture = Form1.Icon
but, I want the project's icon, which isn't necessarily Form1's.
Thanks, DaveBo
"The wise man doesn't know all the answers, but he knows where to find them."
VBForums is one place, but for the really important stuff ... here's a clue 1Tim3:15
-
Jun 6th, 2003, 02:21 PM
#2
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()
'KPD-Team 1998
'URL: [url]http://www.allapi.net/[/url]
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 = "YourFilePath"
'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
Has someone helped you? Then you can Rate their helpful post. 
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
|