Psy
10-26-2004, 02:49 AM
I implemented a menu bar in my program, and I want my program to pause whenever the user clicks any options on the menu bar, how do I do this? :confused:
Help with menu!Psy 10-26-2004, 02:49 AM I implemented a menu bar in my program, and I want my program to pause whenever the user clicks any options on the menu bar, how do I do this? :confused: Deadalus 10-26-2004, 03:51 AM Are you familiar with subclassing? You can subclass the form and catch the WM_ENTERMENULOOP and WM_EXITMENULOOP messages. Psy 10-26-2004, 04:10 AM Sorry but no...........I am very new at programming and just picked up a few weeks ago...... Deadalus 10-26-2004, 04:54 AM First of all, maybe I misunderstood the question. If you only want to do something when a menu option is clicked (like File/New), simply use the Click procedure of the menu items. Typically you would set a boolean variable there and check for that variable in your timer or loop or wherever your main program is running. What I was talking about is detecting when the menu is opened (before any option in the menu is clicked, e.g. when File is clicked to show the menu). Maybe you shouldn't worry about this until you have more experience. But if you want, the attached project shows how to detect when the menu opens and closes. WARNING: If subclassing is used (basically what the call to SetWindowLong does) you MUST NOT run the project in debug mode or stop it with the End command in the IDE. If you do - or when an error is encountered - the project will crash and take the IDE with it. Psy 10-26-2004, 07:12 AM Yes......I was asking about detecting when the menu is opened, and 'pauses' the whole program, like a lot of mini-games out there. I'm not good with words so sorry=p I understand half of the code but I think I'll drop the idea as it seems too complicated for me. Thanks a lot though :) |
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum