FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Help needed about System Menu?
Posts: 1387
Joined: Fri May 23, 2008 01:33 PM
Help needed about System Menu?
Posted: Mon Aug 31, 2009 07:49 PM

Hi,

Is it possible to add a menuitem to system menu?

Thanks,

Regards,



Hakan ONEMLI



Harbour & MSVC 2022 & FWH 23.06
Posts: 1387
Joined: Fri May 23, 2008 01:33 PM
Re: Help needed about System Menu?
Posted: Wed Sep 02, 2009 09:14 AM
Hi,

I found the thread to disable system menu in forum like this.

Code (fw): Select all Collapse
procedure DisableX(ODLG)
local hMenu
hMenu := GetSystemMenu(oDlg:hWnd,.f.)
RemoveMenu( hMenu, 6, MF_BYPOSITION)
RemoveMenu( hMenu, 5, MF_BYPOSITION)
RemoveMenu( hMenu, 4, MF_BYPOSITION)
RemoveMenu( hMenu, 3, MF_BYPOSITION)
RemoveMenu( hMenu, 2, MF_BYPOSITION)
RemoveMenu( hMenu, 1, MF_BYPOSITION)
RemoveMenu( hMenu, 0, MF_BYPOSITION)
return


I search the function like insertMenu or addMenu. I found the AppendMenu() function in FWH function help.

Code (fw): Select all Collapse
AppendMenu( <hMenu>, <nFlags>, <nFlags>, <cPrompt> ) --> lSucces


I try to write the below function, but something is missing. Where Should i say the function which function will execute?

Code (fw): Select all Collapse
procedure AddItemSystemMenu(ODLG, cPrompt, bRunProc)
local hMenu
hMenu := GetSystemMenu(oDlg:hWnd,.f.)
AppendMenu( hMenu, 0, ??, cPrompt)
return


Any Help?
Regards,



Hakan ONEMLI



Harbour & MSVC 2022 & FWH 23.06
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Help needed about System Menu?
Posted: Wed Sep 02, 2009 10:35 AM

Hakan,

It looks from your code like you are trying to add it to a dialog, but dialogs don't have system menus.

Try the ON INIT clause of a window.

ACTIVATE WINDOW oWnd ON INIT...

I'm not sure I would recommend putting anything on the system menu. Most users will not look there, in fact most users don't even know there is a menu there. And I don't think I have ever seen anything but the default items on this menu in any app.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 1387
Joined: Fri May 23, 2008 01:33 PM
Re: Help needed about System Menu?
Posted: Wed Sep 02, 2009 11:27 AM
Hi James,

James Bott wrote:I'm not sure I would recommend putting anything on the system menu. Most users will not look there, in fact most users don't even know there is a menu there. And I don't think I have ever seen anything but the default items on this menu in any app.

James


I aggree with you about The most user don't know the system menu. But I need it. I try to write my own classes. Sometimes I need to save some setting of dialog. This is just for me to design my dialogs not for user.

I found how to add. This was not far away from me. It was soo easy in FWH. It also works in dialogs.

FUNCTION addSys(oDlg)
local oMenu

REDEFINE SYSMENU oMenu OF oDlg
MENUITEM "Item 1" ACTION MsgInfo( "any action" )
MENUITEM "Item 2"
ENDMENU
return oMenu
Regards,



Hakan ONEMLI



Harbour & MSVC 2022 & FWH 23.06

Continue the discussion