Hi all,
I got a vb exe which has three forms. Each form has its own icon. How can i retrieve the icon of each form from another vb project?
Thanks
Printable View
Hi all,
I got a vb exe which has three forms. Each form has its own icon. How can i retrieve the icon of each form from another vb project?
Thanks
Play around with this exampleVB Code:
'In general section Private Declare Function DrawIcon Lib "user32" Alias "DrawIcon" (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] 'E-Mail: [email][email protected][/email] 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