Remove Access Symbol from window

scottfarcus

Registered User.
Local time
Today, 03:11
Joined
Oct 15, 2001
Messages
182
I seem to remember hearing that there was some VBA or an API that I could use to remove or hide the Access symbol from the top-left of each window and replace it with my own icon.

Does anyone here know how to do this?
 
Scratch that. I went to Startup and changed the app icon. That seems to suffice.

How about the default form icon on pop-up forms? Is there a way to specify an icon for each form to replace the default?
 
I regret that I do not remember who to give credit to for this code.

'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
 
Fantastic!

Thank you! (and whomever originally posted the code)
 
Hi ghudon,

I read the thread.

What you wrote is 'place this sub in each forms "Load" event. (even it is one line sub to show location of the icon)

Please correct me if I am wrong Or may be I did not understand properly what is mentioned there in the thread but I have something to ask.

Don't you think it increase the job to put one single line of code in each forms Load event? Bcz I found, if we need to use any suitable icon instead of Access itself, we can just set it from db Window ---Tools---Startup----Application Icon and set below check mark to True. (I created my icons in EasyIcon.Exe software trail version)

This seting also shows my own icon on forms and reports, the same output that results from your code. I have done this way with many of my dbs and its works fine.

So can you please clarify if there is a difference between above.

With kind regards,
Ashfaque

ps: using Access2002 under xp
 

Users who are viewing this thread

Back
Top Bottom