Alex Rivera | Logout

How can I customize the system menu of a Windows Form?

Asked 2011-01-06T14:27:12.070
54

I want to add the age-old About menu item to my application. I want to add it to the system menu of the application (the one which pops up when we click the application icon in the top-left corner). So, how can I do it in .NET?

Edit
Report

1 Answer

6

The value-add is rather small for the amount of pinvoke you'll need. But it is possible. Use GetSystemMenu() to retrieve the system menu handle. Then InsertMenuItem to add an entry. You have to do this in an override of OnHandleCreated() so you recreate the menu when the window gets recreated.

Override WndProc() to recognize the WM_SYSCOMMAND message that's generated when the user clicks it. Visit pinvoke.net for the pinvoke declarations you'll need.

answered 2011-01-06T14:49:08.927

Your Answer