|
-
Sep 29th, 2003, 02:22 AM
#1
Thread Starter
Addicted Member
popupmenu problem with title bar *RESOLVED*
I have a borderless form that I need to use the popupmenu function with. As soon as I add the popupmenu function VB puts a border and a titlebar onto the form. I can't have this.
The only solution I have found is to set the form's caption to "" and the form.controlbox to false. The only problem with this is I need this program to show in the task bar. A blank caption makes a blank taskbar.....
How do I get a borderless form that shows in the taskbar and uses popupmenu?
Thanks!
Last edited by imbue; Sep 29th, 2003 at 01:44 PM.
-
Sep 29th, 2003, 03:57 AM
#2
Registered User
Have the popup menus in a new form and call them from that place.
-
Sep 29th, 2003, 01:51 PM
#3
Thread Starter
Addicted Member
-
Sep 29th, 2003, 03:55 PM
#4
With a couple api calls, you can keep your menu on the same form.
VB Code:
'API Calls Used To Remove The Title Bar From Window (Make A Sizeable Borderless Form)
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 GWL_STYLE = (-16)
Private Const WS_DLGFRAME = &H400000
Private Sub Form_Load()
'ERASE the Title Bar
SetWindowLong Me.hwnd, GWL_STYLE, GetWindowLong(Me.hwnd, GWL_STYLE) + WS_DLGFRAME
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbRightButton Then
Me.PopupMenu mnuPop
End If
End Sub
Private Sub mnuPopExit_Click()
Unload Me
End Sub
-
Sep 29th, 2003, 09:28 PM
#5
Thread Starter
Addicted Member
I haven't tried it yet, but if that works it'll be great. I wouldn't have the overhead of another form and i wouldn't have to go form surfing to edit the menu.
Thanks.
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
|