Click to See Complete Forum and Search --> : Menus


Deanna Lee
November 4th, 1999, 10:59 AM
I need Help! I have an app that places borderless forms on top of a main form. These secondary forms have no min/max buttons and no borders. I only want to see the frame inside the form. These secondary form also have menus, used for popup menus. The menus do not appear in the menu bar. The problem is that with the addition of these menus, there now appears a thin-line black box around the form. It looks like a border. The borderstyle property of the form is set to 0-None. The box or border only appears if there are menus associated with the form. It goes away if I delete the menus. Is there anyone who knows how to remove this box or set it's color? Thanks in advance.

Aaron Young
November 4th, 1999, 05:44 PM
Try This:

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_BORDER = &H800000

private Sub Form_Load()
Call SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) Xor WS_BORDER)
End Sub





Aaron Young
Analyst Programmer
adyoung@win.bright.net
aarony@redwingsoftware.com

November 10th, 1999, 12:18 PM
Deanna, Are you using a MDI/child relation? If yes, when the child displays, are you keeping the MDI menu or is it overwritten by the child menu. If you keep the MDI menu, how did you do that ? Thanks for your time.
Patrick van Oppen

Deanna Lee
November 10th, 1999, 12:49 PM
No, there is no MDI form. I actually found out why this phenomena is happening. Apparently, by design, a form with menus has to have a visible border. My solution was to create a separate form with just the menus needed for right-clicking. Every form that uses the same functionality for right-clicking references the new 'menu' form. The solution worked out quite well, actually. The problem is referenced (as I found out later) in the MS Knowledge Base under Q174214.
Thanks for taking the time to respond. -Deanna.