VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

Set Icons for any Form or Program

J. van Gils  (1 Submission)   Custom Controls/Forms/Menus   Visual Basic 3.0   Unknown Difficulty   Wed 3rd February 2021

With this code you can place any Icon in the title bar of any Window, just by reffering to a .ico file or to the position of the Icon in a DLL.

Inputs
Handle of the window you want to change the icon of.

Assumes
You need to have the Window Handle (hWnd) of the window whitch Icon you want to change. This can be done by searching/finding it with the API-call Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long

Side Effects
none (that I know of)

API Declarations
Declare Function ExtractIcon Lib "shell32.dll" Alias "ExtractIconA" (ByVal hInst As Long, ByVal lpszExeFileName As String, ByVal nIconIndex As Long) As Long
Declare Function DefWindowProc Lib "user32" Alias "DefWindowProcA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Const WM_SETICON = &H80

Rate Set Icons for any Form or Program (3(3 Vote))
Set Icons for any Form or Program.bas

Set Icons for any Form or Program Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters