Can you use animated icons or titles in Access 2003?

TylerTand

Registered User.
Local time
Today, 15:40
Joined
Aug 31, 2007
Messages
95
I would like to create some custom icons and use them in Access. Does anybody have an experience doing this that can start me down the right path? Thanks:)
 
Custom icons, yes, animated icons - more difficult.

Create a module and paste the following code:

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

Then in the "On_Load" event of your form:

If you have a set path to your icon:
SetFormIcon Me.hWnd, "C:\Icons\Icon.ico" 'Location of icon file - change to the name of your icon

or, if you do like I do, and keep the icons in the same folder as the database:

SetFormIcon Me.hWnd, Left(CurrentDb.Name, Len(CurrentDb.Name) - Len(Dir(CurrentDb.Name))) & “\myicon.ico"

Dave
 

Users who are viewing this thread

Back
Top Bottom