Link to home
Start Free TrialLog in
Avatar of rogerrr
rogerrr

asked on

Is window a real popup menu or not? WS_POPUP

Hi All!

I have a fsStayOnTop and bsNone form that's created with WS_POPUP style flag, but this window is not a popup menu like a shell context menu or a system menu. How can i detect that the window is not a 'real' menu popup window? I tried everything.

IsWindow; IsMenu; IsAnyPopup;  GetWindowLong(...WS_CAPTION...); GetMenu; GetSystemMenu etc... but i didn't find a perfect solution.

Is there any unique difference between a ws_popup form and a real menu popup window?

Thanks in advance!
Avatar of TName
TName

What' wrong with
"is TForm"?

 if Form2 is TForm then
     ShowMessage('True')
  else
     ShowMessage('False');


BTW,

 if TControl(PopUpMenu1) is TForm then
    ShowMessage('True')
  else
    ShowMessage('False');

will always be false
Avatar of rogerrr

ASKER

Yes, you're in right but the form was an example. But how can i detect it if the windowclass is not a TForm is not a Delphi application window?
ASKER CERTIFIED SOLUTION
Avatar of AmigoJack
AmigoJack

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rogerrr

ASKER

I have a StayOnTop form and i want to keep it always on top, but not over popup menus, dropdown lists and file menus. I'm hooking the WM_WINDOWPOSCHANGING and WM_WINDOWPOSCHANGED messages. If a window has WS_POPUP style then i don't send it back because default it's a menu popup. But there are some other windows created with WS_POPUP flag (e.g. a simple fsStayOnTop form without border-->bsNone) but they aren't real menu popup windows because they don't contains any menu elements...

And i'd like to find a difference between a real and a 'phantom' popup window.
i dont understand you clearly - mostly because you mix WS_POPUP with MENUes. menues themselves are something completely else, no matter if they come from the system (like maximize, minimize, restore...), from the window (file, edit, help...) or from the context (rightclick). its their nature to be more on top - even when there are stay-topmost windows. you cant influence that. same goes with comboboxes. in fact, every combobox has another window handle (which then is the listbox you get as the popular "dropdown" - thats also always topmost).

if you create a window and set its z-order with the TOPMOST flag to stay in front it should behave quite well. what else do you want? if there are other windows which are also always topmost, then both your and that window will behave like all other windows - only in their group. that means the one you click on is then really on top.

oh: and setting fsStayOnTop in delphi and using setwindowpos() are different things. experiment on that
Forced accept.

Computer101
EE Admin