Wednesday, December 17, 2008

[vb6] Get rid of the title bar

Problem: I don't want my program to have a titlebar but I do want it listed in the Windows Taskbar. I figured out that I could get rid of the title bar by turning off the controlbox setting and setting the caption to "" but this gives me a blank bar in the taskbar too. Annoyingly, the "ShowInTaskbar" setting is only available at design time so I can't turn it off when the window is visible and back on when minimized. Solution: Set the following form properties: BorderStyle: 0 - None, Caption: whatever, ShowInTaskBar: True and WindowState: 1 - Minimized. Then, in the form load procedure give the form a 3d border by changing its style:
    Private Const WS_DLGFRAME& = &H400000
ModifyStyle hwnd, 0, WS_DLGFRAME
See the tip on the ModifyStyle function and the tip on enabling moving of forms with no title bar.

No comments:

Post a Comment