Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

The Delphi Start-Bar System Menu for Apps

bikibiki Posts: 492Member
[green]
As you might have noticed, the Delphi or C++ Builder apps do not have the full context menu displayed when u click on the tab for the app in the taskbar(start-bar).

I've tried some solutions to display all, and make them behave properly, but with not much success. Since there is a hidden main window, Win32 cannot automatically show the 'Move', 'Size', and 'Maximize' menu items.

Does anyone have a good solution ?

Zibadian?

[/green]
[hr][red]~Bikram[/red]

Comments

  • zibadianzibadian Posts: 6,349Member
    : [green]
    : As you might have noticed, the Delphi or C++ Builder apps do not have the full context menu displayed when u click on the tab for the app in the taskbar(start-bar).
    :
    : I've tried some solutions to display all, and make them behave properly, but with not much success. Since there is a hidden main window, Win32 cannot automatically show the 'Move', 'Size', and 'Maximize' menu items.
    :
    : Does anyone have a good solution ?
    :
    : Zibadian?
    :
    : [/green]
    : [hr][red]~Bikram[/red]
    :
    Creating taskbar menu items has been asked recently, so I won't handle that. (Link: http://www.programmersheaven.com/c/MsgBoard/read.asp?Board=4&MsgID=198580&Setting=A0001F2001). Fore more info on these functions see the windows SDK on InsertMenuItem.
    As for catching the menu item clicks, you need to intercept the WM_COMMAND message sent by it. This can be best done in the TApplication.OnMessage() event (or TApplicationEvents). The loword of the wParam should contain the ID given to the menu item. Here is a small untested pseudocode to show how to handle the these messages.
    [code]
    procedure TForm1.ApplicationMessage(var Msg: TMsg; var Handled: Boolean);
    begin
    if Msg.Message = WM_COMMAND then
    case Msg.wParam of
    // Place the menu item ID's here and handle them in other routines
    end;
    end;
    [/code]
    Advice: Do not place any breakpoints in this routine.
  • bikibiki Posts: 492Member
    [green]Making Menuitems and catching events is not a problem. The problem is, how to show the 'Size'/'Move'/'Maximize' menuitems and make it behave 'properly' i.e. exactly like a normal windows app. The problem is all caused due the hidden window!

    Any other suggestions ?[/green]
    [hr][red]~Bikram[/red]

  • zibadianzibadian Posts: 6,349Member
    : [green]Making Menuitems and catching events is not a problem. The problem is, how to show the 'Size'/'Move'/'Maximize' menuitems and make it behave 'properly' i.e. exactly like a normal windows app. The problem is all caused due the hidden window!
    :
    : Any other suggestions ?[/green]
    : [hr][red]~Bikram[/red]
    :
    :
    The link I gave you explains how to add menu items to the taskbar menu. Once you added them they should show up like any other menu item of that menu. Since I never use those menus, I've checked them to find the solution how to let them behave.

    Maximize: Just use the TForm.WindowState to maximize the form.

    Move: Use the TScreen.Cursor property to change the cursor into the crSizeAll. Then Use the TMouse.CursorPos to move it to the middle of the title bar.

    Size: Same as Move, but move it to the middle of the form.

    This should imitate the default behaviour. I haven't done it myself, but theoretically should it work.
Sign In or Register to comment.