When you create a borderless form in VB (BorderStyle = 0) and make it visible to the taskbar (ShowInTaskbar = True), only the form’s caption shows and the form’s icon is invisible. To display the icon, you must add a system menu to the form by modifying the style. This also gives you the ability to right-click on the taskbar button and see a standard system menu, but the items in it won’t work unless you subclass the form and handle the system menu Click events yourself.
Add this code to the Declarations section of a form:
Private Declare Function GetWindowLong Lib _ "user32" Alias "GetWindowLongA" (ByVal hWnd _ As Long, ByVal nIndex As Long) As LongPrivate Declare Function SetWindowLong Lib _ "user32" Alias "SetWindowLongA" (ByVal hWnd _ As Long, ByVal nIndex As Long, ByVal _ dwNewLong As Long) As LongPrivate Const GWL_STYLE = (-16)Private Const WS_SYSMENU = &H80000
Add this code to the Form_Load event:
Dim lStyle As LonglStyle = GetWindowLong(hWnd, GWL_STYLE) Or _ WS_SYSMENUSetWindowLong hWnd, GWL_STYLE, lStyle