|
-
Apr 28th, 2001, 05:48 PM
#1
Thread Starter
New Member
Help with Title bar/ Taskbar Caption
I'm making some software and I need help (what type of program it is isn't important). On a form I've made the caption nothing, no controll box, no Maximize button, and no minimize button. So the title bar is not there. I put a graphic of my own title bar, and I already figured out how to let the user drag that to move the window instead of the regular windows title bar. But since there is no caption for the form, there is no caption for it's button on the taskbar. Is there a way to put a caption (and if possible, an icon) on the form's taskbar button yet still allowing the form's title bar to not be there?
Thanks, I'd appreciate some help....
MrMcModem
-
Apr 28th, 2001, 06:15 PM
#2
Put this in a module: (or change everywhere that says Public to Private and put it in the top of the form)
Code:
Public Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Public Const SWP_NOMOVE = &H2
Public Const SWP_NOSIZE = &H1
Public Const SWP_FRAMECHANGED = &H20
Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Const WS_CAPTION = &HC00000
Public Const GWL_STYLE = (-16)
Set the ControlBox property of the form back to True and give the form a caption. Leave MinButton and MaxButton set at False.
Then this code will take out the titlebar: (you probably want to put it in Form_Load)
Code:
Dim lStyle As Long
lStyle = GetWindowLong(Me.hwnd, GWL_STYLE)
lStyle = lStyle Xor WS_CAPTION
SetWindowLong Me.hwnd, GWL_STYLE, lStyle
SetWindowPos Me.hwnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED Or SWP_NOMOVE Or SWP_NOSIZE
-
Apr 28th, 2001, 06:21 PM
#3
Take out the WS_CAPTION style.
Code:
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Const WS_CAPTION = &HC00000
Private Const GWL_STYLE = (-16)
Private Sub Command1_Click()
WindowState = 1
Hide
Dim lStyle As Long
lStyle = GetWindowLong(Me.hwnd, GWL_STYLE) Xor WS_CAPTION
SetWindowLong hwnd, GWL_STYLE, lStyle
WindowState = 0
Show
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|