Icons after start up

Dave Titan

Registered User.
Local time
Today, 16:12
Joined
Jan 1, 2002
Messages
69
I've the DB set up to have an Icon. It also has a pop up screen and then a Switchboard based on a form.

How do I keep the icon on the top of each form that's opened from the options on the switchboard.

In other words I open a form from the switchboard now, and the new form shows the Access form Icon, and then the name of the form. I want my own Icon showing in the topleft of each form. Just as it is in the DB main frame
 
Last edited:
I'm fairly sure that the Icon can only reside on the application title bar, not on each form's title bar. I may be wrong though.....
 
Shame if that's all there was too it.

It adds a nice touch to have an icon on each form.
 
Dave

You can remove the Access icon from the forms title bar by selecting not to show the forms Control Box

HTH

Graham
 
There is API code around that will let you use your own icons, or you could cheat, remove the Form border and add labels for the caption, minimise,restore buttons etc so that it looks like a conventional form, just add your icon
 
I do not remember where I found this code but it works in Access 97. It you only want the icon to show at the top of the form without the form name, key a single space in the form's Caption property.

'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
 

Users who are viewing this thread

Back
Top Bottom