Help needed about System Menu?

Help needed about System Menu?

Postby Horizon » Mon Aug 31, 2009 7:49 pm

Hi,

Is it possible to add a menuitem to system menu?

Thanks,
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1322
Joined: Fri May 23, 2008 1:33 pm

Re: Help needed about System Menu?

Postby Horizon » Wed Sep 02, 2009 9:14 am

Hi,

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

Code: Select all  Expand view
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: Select all  Expand view
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: Select all  Expand view
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.04
Horizon
 
Posts: 1322
Joined: Fri May 23, 2008 1:33 pm

Re: Help needed about System Menu?

Postby James Bott » 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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Help needed about System Menu?

Postby Horizon » 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.04
Horizon
 
Posts: 1322
Joined: Fri May 23, 2008 1:33 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 71 guests