Results 1 to 5 of 5

Thread: popupmenu problem with title bar *RESOLVED*

  1. #1

    Thread Starter
    Addicted Member imbue's Avatar
    Join Date
    Aug 2002
    Location
    Midwest USA
    Posts
    155

    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.

  2. #2
    Registered User HellRaider's Avatar
    Join Date
    Sep 2003
    Posts
    70
    Have the popup menus in a new form and call them from that place.

  3. #3

    Thread Starter
    Addicted Member imbue's Avatar
    Join Date
    Aug 2002
    Location
    Midwest USA
    Posts
    155
    Works good! Thanks.

  4. #4
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141
    With a couple api calls, you can keep your menu on the same form.
    VB Code:
    1. 'API Calls Used To Remove The Title Bar From Window (Make A Sizeable Borderless Form)
    2. Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
    3.                             (ByVal hwnd As Long, ByVal nIndex As Long, _
    4.                             ByVal dwNewLong As Long) As Long
    5. Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _
    6.                             (ByVal hwnd As Long, ByVal nIndex As Long) As Long
    7.                            
    8. Private Const GWL_STYLE = (-16)
    9. Private Const WS_DLGFRAME = &H400000
    10.  
    11. Private Sub Form_Load()
    12.     'ERASE the Title Bar
    13.     SetWindowLong Me.hwnd, GWL_STYLE, GetWindowLong(Me.hwnd, GWL_STYLE) + WS_DLGFRAME
    14. End Sub
    15.  
    16. Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    17.     If Button = vbRightButton Then
    18.         Me.PopupMenu mnuPop
    19.     End If
    20. End Sub
    21.  
    22. Private Sub mnuPopExit_Click()
    23.     Unload Me
    24. End Sub

  5. #5

    Thread Starter
    Addicted Member imbue's Avatar
    Join Date
    Aug 2002
    Location
    Midwest USA
    Posts
    155

    Thumbs up

    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
  •  



Click Here to Expand Forum to Full Width