Ranjith
Ranjith

Reputation: 794

How do i get menu events from a menu item in the system menu of a console window?

I have added a menu item to the SystemMenu of the console window of my application which i created using the AllocConsole() function. but I could not figure out how to process the events for the menu items I've added.

How can i process those menu events?

Thank you

Upvotes: 0

Views: 962

Answers (1)

Ismael
Ismael

Reputation: 3013

Did you try overriding window proc of the console window? ie once you have obtained the window handle with GetConsoleWindow and then hooked its window proc with SetWindowLongPtr, you have to listen the WM_SYSCOMMAND message. See this article on how to process menu items from system menu.

Upvotes: 1

Related Questions