Home All Groups Group Topic Archive Search About

RemoveMenu or EnableMenuItem not always working

Author
25 Mar 2005 4:06 PM
Joe
I have a MDI app where 2 children forms should never be closed. I'm using
RemoveMenu API to remove the close X and context menu item. This works fine
on one form but not on the other. The major difference between these 2 forms
is that the one that doesn't work has an ActiveX control.

If I can put the RemoveMenu() in the Activate event of the form it will work
after reactivating the form by clicking on another form then back again.
This has 2 problems though. First the user could close the form as long as
the form didn't become deactive and second, the Windows top bar where the
Control box it located no longer works so the form can't be dragged and also
can't be double clicked to maximize the window.

If I call GetLastError() after calling DrawMenuBar() it returns 1400 -
Invalid window handle.

Any ideas why? Could the ActiveX control be causing the problem?

Thanks,
Joe

Author
25 Mar 2005 4:19 PM
Joe
Fixed the invalid window handle problem. I was passing the hmenu to the
DrawMenuBar() instead of the form.handle.

BUT I still have the problem where the form with the ActiveX control doesn't
disable to menu item.


Show quote
"Joe" <J_no_spam@_no_spam_Fishinbrain.com> wrote in message
news:#J5MRSVMFHA.1308@tk2msftngp13.phx.gbl...
> I have a MDI app where 2 children forms should never be closed. I'm using
> RemoveMenu API to remove the close X and context menu item. This works
fine
> on one form but not on the other. The major difference between these 2
forms
> is that the one that doesn't work has an ActiveX control.
>
> If I can put the RemoveMenu() in the Activate event of the form it will
work
> after reactivating the form by clicking on another form then back again.
> This has 2 problems though. First the user could close the form as long as
> the form didn't become deactive and second, the Windows top bar where the
> Control box it located no longer works so the form can't be dragged and
also
> can't be double clicked to maximize the window.
>
> If I call GetLastError() after calling DrawMenuBar() it returns 1400 -
> Invalid window handle.
>
> Any ideas why? Could the ActiveX control be causing the problem?
>
> Thanks,
> Joe
>
>

AddThis Social Bookmark Button