Can you pick an icon for seperate forms/reports

rheide

Registered User.
Local time
Today, 06:24
Joined
Jun 12, 2002
Messages
32
Hello Eveyone,
Is there anyway to specify a different "application icon" for each report/form in a database. I know if you go to Tools/Startup you can say, Use as Form and Report Icon, but can you pick a different icon for each form/report?

Thanks,
Randy
 
If you searched this forum for icons and forms you might have found this old posting I made @

API: show Icon on a form

Here is the code again...

'place this sub in each forms "Load" event
Private Sub Form_Load()
SetFormIcon Me.hWnd, "C:\Icons\Icon1.ico" 'Location of icon file
End Sub

'copy below code in a new public module
Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long

Private Const WM_SETICON = &H80
Private Const IMAGE_ICON = 1
Private Const LR_LOADFROMFILE = &H10
Private Const SM_CXSMICON As Long = 49
Private Const SM_CYSMICON As Long = 50

Private Declare Function LoadImage Lib "user32" Alias "LoadImageA" (ByVal hInst As Long, ByVal lpsz As String, ByVal un1 As Long, ByVal n1 As Long, ByVal n2 As Long, ByVal un2 As Long) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, LParam As Any) As Long

Public Function SetFormIcon(hWnd As Long, strIconPath As String) As Boolean
Dim lIcon As Long
Dim lResult As Long
Dim X As Long, Y As Long

X = GetSystemMetrics(SM_CXSMICON)
Y = GetSystemMetrics(SM_CYSMICON)
lIcon = LoadImage(0, strIconPath, 1, X, Y, LR_LOADFROMFILE)
lResult = SendMessage(hWnd, WM_SETICON, 0, ByVal lIcon)
End Function

HTH
 
Thanks ghudson. I appreciate the help.

I was searching in the "forms" forum only (not sure why) and I couldn't find anything, but after you made this post I went and searching again and sure enough there was more than one post regarding this topic. Anway, just wanted to say thanks and assure you that I always search first (and search again and again) but somehow I missed this one.

Thanks again,
Randy
 

Users who are viewing this thread

Back
Top Bottom