Is there a way to make a menuitem invisible?
In VB6 you could do this easily. It is very handy if you want to do a standard and a lite version of a program.
The only way I found to do this is this:
1. FF_Menu_SetText to ""
2. FF_Menu_SetState to %MFS_DISABLED
That still leave a space for the menu.
Is there a more elegant way?
I think that the only way to do this is to RemoveMenu and/or InsertMenu. Maybe there is a better way. Not sure.
'--------------------------------------------------------------------------------
Function FORM1_COMMAND1_BN_CLICKED ( _
ControlIndex As Long, _ ' index in Control Array
hWndForm As Dword, _ ' handle of Form
hWndControl As Dword, _ ' handle of Control
idButtonControl As Long _ ' identifier of button
) As Long
RemoveMenu HWND_FORM1_TOPMENU, IDC_FORM1_MNUPRINT, %MF_BYCOMMAND
DrawMenuBar hWndForm
End Function
'--------------------------------------------------------------------------------
Function FORM1_COMMAND2_BN_CLICKED ( _
ControlIndex As Long, _ ' index in Control Array
hWndForm As Dword, _ ' handle of Form
hWndControl As Dword, _ ' handle of Control
idButtonControl As Long _ ' identifier of button
) As Long
Local sMenuText As Asciiz * 50
sMenuText = "Print..." & $Tab & "Ctrl+P"
InsertMenu HWND_FORM1_TOPMENU, IDC_FORM1_MNURECENTPROJECTS, _
%MF_BYCOMMAND Or %MF_STRING, _
IDC_FORM1_MNUPRINT, _
sMenuText
DrawMenuBar hWndForm
End Function
Thanks, Paul.