Display Taskbar Icons for Borderless Forms

Posted on 2004-11-07
Last Modified: 2012-05-05
Does anybody know how to do this but in

Display Taskbar Icons for Borderless Forms
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 Long
Private Declare Function SetWindowLong Lib _
      "user32" Alias "SetWindowLongA" (ByVal hWnd _
      As Long, ByVal nIndex As Long, ByVal _
      dwNewLong As Long) As Long

Private Const GWL_STYLE = (-16)
Private Const WS_SYSMENU = &H80000

Add this code to the Form_Load event:

Dim lStyle As Long
lStyle = GetWindowLong(hWnd, GWL_STYLE) Or _
SetWindowLong hWnd, GWL_STYLE, lStyle

Question by:VectorX
    1 Comment
    LVL 18

    Accepted Solution

    I have done it in VB.NET, it works fine..
    I created a Form, made the FormBorderStyle = None and ShowInTaskBar = true..
    Set a different Icon..

    When Run, The Icon is shown in Taskbar

    Dont get the problem ?

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
    Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now