[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Display Taskbar Icons for Borderless Forms

Posted on 2004-11-07
Medium Priority
Last Modified: 2012-05-05
Does anybody know how to do this but in vb.net?

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

armoghan earned 760 total points
ID: 12521462
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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Screencast - Getting to Know the Pipeline
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

834 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