RemoveMenu or EnableMenuItem not always working

  • Thread starter Thread starter Joe
  • Start date Start date
J

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
 
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.
 
Back
Top