Advertisement
2002ASP Custom Controls/ Forms/ Menus #441

Set Icons for any Form or Program

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.

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
Public Function SetIcon(FormhWnd As Long)
Dim x, i As Long
  i = ExtractIcon(0, "c:\SomeDll.DLL", 3)
   'In this case you will extract the 3rd icon from SomeDll.DLL. In this
   'way you can extract any icon you want, just by reffering to the icon
   '(number) of the icon you want to extract in the dll. If you want to 
   'know the iconnumbers of a dll, you will have to use a recource editor
   '(like Borland Recource Workshop). You can also extract the Icon Handle
   'of a .ico file just by using some code like:
   'i=ExtractIcon(0,"c:\SomeIconFile.ico",0)
   'where SomeIconFile is the name of the icon you want to use.
   'Now finally set the icon in the title bar of the window
  x = DefWindowProc(FormhWnd, WM_SETICON, &H1, i)
End Function
Original Comments (3)
Recovered from Wayback Machine