-
EnableMenu api call does nothing
For an MDI Child, I am trying to modify the system menu so that the "Next"
menu command is disabled.
I have the following code in a module:
Public Declare Function ModifyMenu Lib "user32" Alias "ModifyMenuA" (ByVal
hMenu As Long, ByVal uPosition As Long, ByVal uFlags As Long, ByVal uIDNewItem
As Long, ByVal lpNewItem As String) As Long
Public Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal
bRevert As Long) As Long
Const MF_BYCOMMAND = &H0&
Const MF_GRAYED = &H1&
Const SC_NEXTWINDOW = &HF040&
in the command_click of of a button i have:
hMenu = GetSystemMenu(Me.hwnd, 0)
iRet = ModifyMenu(hMenu, SC_NEXTWINDOW, MF_BYCOMMAND Or MF_GRAYED, SC_NEXTWINDOW,
"Nex&t" & Chr(9) & "Ctrl+F6")
but this does nothing. I have no idea why. Any help is appreciated.
Ron
-
Re: EnableMenu api call does nothing
Use the EnableMenuItem api:
Declare Function EnableMenuItem Lib "user32" ( _
ByVal hMenu As Long, _
ByVal uIDEnableItem As Long, _
ByVal uEnable As Long) As Long
' Enable the item
hMenu = GetSystemMenu(Me.hwnd, 0)
EnableMenuItem hMenu, SC_NEXTWINDOW, MF_BYCOMMAND Or _
MF_ENABLED
' Disable the item
hMenu = GetSystemMenu(Me.hwnd, 0)
EnableMenuItem hMenu, SC_NEXTWINDOW, MF_BYCOMMAND Or _
MF_DISABLED
HTH
--
Eduardo A. Morcillo
http://www.domaindlx.com/e_morcillo
"ron" <ron_nospam@ron.com> wrote in message news:3957b5e7$1@news.devx.com...
>
> For an MDI Child, I am trying to modify the system menu so that the "Next"
> menu command is disabled.
>
> I have the following code in a module:
>
> Public Declare Function ModifyMenu Lib "user32" Alias "ModifyMenuA" (ByVal
> hMenu As Long, ByVal uPosition As Long, ByVal uFlags As Long, ByVal
uIDNewItem
> As Long, ByVal lpNewItem As String) As Long
> Public Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long,
ByVal
> bRevert As Long) As Long
>
> Const MF_BYCOMMAND = &H0&
> Const MF_GRAYED = &H1&
> Const SC_NEXTWINDOW = &HF040&
>
>
> in the command_click of of a button i have:
>
>
> hMenu = GetSystemMenu(Me.hwnd, 0)
> iRet = ModifyMenu(hMenu, SC_NEXTWINDOW, MF_BYCOMMAND Or MF_GRAYED,
SC_NEXTWINDOW,
> "Nex&t" & Chr(9) & "Ctrl+F6")
>
>
> but this does nothing. I have no idea why. Any help is appreciated.
>
> Ron
-
Re: EnableMenu api call does nothing
Use the EnableMenuItem api:
Declare Function EnableMenuItem Lib "user32" ( _
ByVal hMenu As Long, _
ByVal uIDEnableItem As Long, _
ByVal uEnable As Long) As Long
' Enable the item
hMenu = GetSystemMenu(Me.hwnd, 0)
EnableMenuItem hMenu, SC_NEXTWINDOW, MF_BYCOMMAND Or _
MF_ENABLED
' Disable the item
hMenu = GetSystemMenu(Me.hwnd, 0)
EnableMenuItem hMenu, SC_NEXTWINDOW, MF_BYCOMMAND Or _
MF_DISABLED
HTH
--
Eduardo A. Morcillo
http://www.domaindlx.com/e_morcillo
"ron" <ron_nospam@ron.com> wrote in message news:3957b5e7$1@news.devx.com...
>
> For an MDI Child, I am trying to modify the system menu so that the "Next"
> menu command is disabled.
>
> I have the following code in a module:
>
> Public Declare Function ModifyMenu Lib "user32" Alias "ModifyMenuA" (ByVal
> hMenu As Long, ByVal uPosition As Long, ByVal uFlags As Long, ByVal
uIDNewItem
> As Long, ByVal lpNewItem As String) As Long
> Public Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long,
ByVal
> bRevert As Long) As Long
>
> Const MF_BYCOMMAND = &H0&
> Const MF_GRAYED = &H1&
> Const SC_NEXTWINDOW = &HF040&
>
>
> in the command_click of of a button i have:
>
>
> hMenu = GetSystemMenu(Me.hwnd, 0)
> iRet = ModifyMenu(hMenu, SC_NEXTWINDOW, MF_BYCOMMAND Or MF_GRAYED,
SC_NEXTWINDOW,
> "Nex&t" & Chr(9) & "Ctrl+F6")
>
>
> but this does nothing. I have no idea why. Any help is appreciated.
>
> Ron
-
Re: EnableMenu api call does nothing
I tried the following:
const SC_MOVE = &HF010&
and tried this with the Move command. It had no effect. Same with maximize,
etc
"Eduardo A. Morcillo" <e_morcillo@yahoo.com> wrote:
>Use the EnableMenuItem api:
>
>Declare Function EnableMenuItem Lib "user32" ( _
> ByVal hMenu As Long, _
> ByVal uIDEnableItem As Long, _
> ByVal uEnable As Long) As Long
>
>
>' Enable the item
>hMenu = GetSystemMenu(Me.hwnd, 0)
>EnableMenuItem hMenu, SC_NEXTWINDOW, MF_BYCOMMAND Or _
> MF_ENABLED
>
>' Disable the item
>hMenu = GetSystemMenu(Me.hwnd, 0)
>EnableMenuItem hMenu, SC_NEXTWINDOW, MF_BYCOMMAND Or _
> MF_DISABLED
>
>HTH
>--
>Eduardo A. Morcillo
>http://www.domaindlx.com/e_morcillo
>"ron" <ron_nospam@ron.com> wrote in message news:3957b5e7$1@news.devx.com...
>>
>> For an MDI Child, I am trying to modify the system menu so that the "Next"
>> menu command is disabled.
>>
>> I have the following code in a module:
>>
>> Public Declare Function ModifyMenu Lib "user32" Alias "ModifyMenuA" (ByVal
>> hMenu As Long, ByVal uPosition As Long, ByVal uFlags As Long, ByVal
>uIDNewItem
>> As Long, ByVal lpNewItem As String) As Long
>> Public Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long,
>ByVal
>> bRevert As Long) As Long
>>
>> Const MF_BYCOMMAND = &H0&
>> Const MF_GRAYED = &H1&
>> Const SC_NEXTWINDOW = &HF040&
>>
>>
>> in the command_click of of a button i have:
>>
>>
>> hMenu = GetSystemMenu(Me.hwnd, 0)
>> iRet = ModifyMenu(hMenu, SC_NEXTWINDOW, MF_BYCOMMAND Or MF_GRAYED,
>SC_NEXTWINDOW,
>> "Nex&t" & Chr(9) & "Ctrl+F6")
>>
>>
>> but this does nothing. I have no idea why. Any help is appreciated.
>>
>> Ron
>
>
-
Re: EnableMenu api call does nothing
I tried the following:
const SC_MOVE = &HF010&
and tried this with the Move command. It had no effect. Same with maximize,
etc
"Eduardo A. Morcillo" <e_morcillo@yahoo.com> wrote:
>Use the EnableMenuItem api:
>
>Declare Function EnableMenuItem Lib "user32" ( _
> ByVal hMenu As Long, _
> ByVal uIDEnableItem As Long, _
> ByVal uEnable As Long) As Long
>
>
>' Enable the item
>hMenu = GetSystemMenu(Me.hwnd, 0)
>EnableMenuItem hMenu, SC_NEXTWINDOW, MF_BYCOMMAND Or _
> MF_ENABLED
>
>' Disable the item
>hMenu = GetSystemMenu(Me.hwnd, 0)
>EnableMenuItem hMenu, SC_NEXTWINDOW, MF_BYCOMMAND Or _
> MF_DISABLED
>
>HTH
>--
>Eduardo A. Morcillo
>http://www.domaindlx.com/e_morcillo
>"ron" <ron_nospam@ron.com> wrote in message news:3957b5e7$1@news.devx.com...
>>
>> For an MDI Child, I am trying to modify the system menu so that the "Next"
>> menu command is disabled.
>>
>> I have the following code in a module:
>>
>> Public Declare Function ModifyMenu Lib "user32" Alias "ModifyMenuA" (ByVal
>> hMenu As Long, ByVal uPosition As Long, ByVal uFlags As Long, ByVal
>uIDNewItem
>> As Long, ByVal lpNewItem As String) As Long
>> Public Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long,
>ByVal
>> bRevert As Long) As Long
>>
>> Const MF_BYCOMMAND = &H0&
>> Const MF_GRAYED = &H1&
>> Const SC_NEXTWINDOW = &HF040&
>>
>>
>> in the command_click of of a button i have:
>>
>>
>> hMenu = GetSystemMenu(Me.hwnd, 0)
>> iRet = ModifyMenu(hMenu, SC_NEXTWINDOW, MF_BYCOMMAND Or MF_GRAYED,
>SC_NEXTWINDOW,
>> "Nex&t" & Chr(9) & "Ctrl+F6")
>>
>>
>> but this does nothing. I have no idea why. Any help is appreciated.
>>
>> Ron
>
>
-
Re: EnableMenu api call does nothing
I didn't tried it. Maybe Windows is reseting the item when the menu is
opened or the form is moved or resized. Did you try to remove the item
instead of disable it?
--
Eduardo A. Morcillo
http://www.domaindlx.com/e_morcillo
"Ron" <ron_nospam@ron.com> wrote in message news:3958a155$1@news.devx.com...
>
> I tried the following:
>
> const SC_MOVE = &HF010&
>
> and tried this with the Move command. It had no effect. Same with
maximize,
> etc
>
> "Eduardo A. Morcillo" <e_morcillo@yahoo.com> wrote:
> >Use the EnableMenuItem api:
> >
> >Declare Function EnableMenuItem Lib "user32" ( _
> > ByVal hMenu As Long, _
> > ByVal uIDEnableItem As Long, _
> > ByVal uEnable As Long) As Long
> >
> >
> >' Enable the item
> >hMenu = GetSystemMenu(Me.hwnd, 0)
> >EnableMenuItem hMenu, SC_NEXTWINDOW, MF_BYCOMMAND Or _
> > MF_ENABLED
> >
> >' Disable the item
> >hMenu = GetSystemMenu(Me.hwnd, 0)
> >EnableMenuItem hMenu, SC_NEXTWINDOW, MF_BYCOMMAND Or _
> > MF_DISABLED
> >
> >HTH
> >--
> >Eduardo A. Morcillo
> >http://www.domaindlx.com/e_morcillo
> >"ron" <ron_nospam@ron.com> wrote in message
news:3957b5e7$1@news.devx.com...
> >>
> >> For an MDI Child, I am trying to modify the system menu so that the
"Next"
> >> menu command is disabled.
> >>
> >> I have the following code in a module:
> >>
> >> Public Declare Function ModifyMenu Lib "user32" Alias "ModifyMenuA"
(ByVal
> >> hMenu As Long, ByVal uPosition As Long, ByVal uFlags As Long, ByVal
> >uIDNewItem
> >> As Long, ByVal lpNewItem As String) As Long
> >> Public Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long,
> >ByVal
> >> bRevert As Long) As Long
> >>
> >> Const MF_BYCOMMAND = &H0&
> >> Const MF_GRAYED = &H1&
> >> Const SC_NEXTWINDOW = &HF040&
> >>
> >>
> >> in the command_click of of a button i have:
> >>
> >>
> >> hMenu = GetSystemMenu(Me.hwnd, 0)
> >> iRet = ModifyMenu(hMenu, SC_NEXTWINDOW, MF_BYCOMMAND Or MF_GRAYED,
> >SC_NEXTWINDOW,
> >> "Nex&t" & Chr(9) & "Ctrl+F6")
> >>
> >>
> >> but this does nothing. I have no idea why. Any help is appreciated.
> >>
> >> Ron
> >
> >
>
-
Re: EnableMenu api call does nothing
I didn't tried it. Maybe Windows is reseting the item when the menu is
opened or the form is moved or resized. Did you try to remove the item
instead of disable it?
--
Eduardo A. Morcillo
http://www.domaindlx.com/e_morcillo
"Ron" <ron_nospam@ron.com> wrote in message news:3958a155$1@news.devx.com...
>
> I tried the following:
>
> const SC_MOVE = &HF010&
>
> and tried this with the Move command. It had no effect. Same with
maximize,
> etc
>
> "Eduardo A. Morcillo" <e_morcillo@yahoo.com> wrote:
> >Use the EnableMenuItem api:
> >
> >Declare Function EnableMenuItem Lib "user32" ( _
> > ByVal hMenu As Long, _
> > ByVal uIDEnableItem As Long, _
> > ByVal uEnable As Long) As Long
> >
> >
> >' Enable the item
> >hMenu = GetSystemMenu(Me.hwnd, 0)
> >EnableMenuItem hMenu, SC_NEXTWINDOW, MF_BYCOMMAND Or _
> > MF_ENABLED
> >
> >' Disable the item
> >hMenu = GetSystemMenu(Me.hwnd, 0)
> >EnableMenuItem hMenu, SC_NEXTWINDOW, MF_BYCOMMAND Or _
> > MF_DISABLED
> >
> >HTH
> >--
> >Eduardo A. Morcillo
> >http://www.domaindlx.com/e_morcillo
> >"ron" <ron_nospam@ron.com> wrote in message
news:3957b5e7$1@news.devx.com...
> >>
> >> For an MDI Child, I am trying to modify the system menu so that the
"Next"
> >> menu command is disabled.
> >>
> >> I have the following code in a module:
> >>
> >> Public Declare Function ModifyMenu Lib "user32" Alias "ModifyMenuA"
(ByVal
> >> hMenu As Long, ByVal uPosition As Long, ByVal uFlags As Long, ByVal
> >uIDNewItem
> >> As Long, ByVal lpNewItem As String) As Long
> >> Public Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long,
> >ByVal
> >> bRevert As Long) As Long
> >>
> >> Const MF_BYCOMMAND = &H0&
> >> Const MF_GRAYED = &H1&
> >> Const SC_NEXTWINDOW = &HF040&
> >>
> >>
> >> in the command_click of of a button i have:
> >>
> >>
> >> hMenu = GetSystemMenu(Me.hwnd, 0)
> >> iRet = ModifyMenu(hMenu, SC_NEXTWINDOW, MF_BYCOMMAND Or MF_GRAYED,
> >SC_NEXTWINDOW,
> >> "Nex&t" & Chr(9) & "Ctrl+F6")
> >>
> >>
> >> but this does nothing. I have no idea why. Any help is appreciated.
> >>
> >> Ron
> >
> >
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks