![]() |
A menu issue -
Sup guys,
A part of my menu is supposed to capture all open windows and list them, the problem is; since the number of windows could be random I have no way of knowing what's open so I need to know what the user clicked on, I prepared this piece of code to do that - :
Sadly enough though my program does not retrieve the title... Do you guys know what went wrong or of any easier way? Thanks. |
Re: A menu issue -
You need to check the return value of MenuItemFromPoint() to see if it is a valid position. It returns -1 on error. And is that code inside the menu event handler ?
|
Re: A menu issue -
Quote:
:
I have done it like this because if there is any menu item that has no identifier(in my code its only the list of windows) it would get passed to th default and I should be able to take things by doing that. When a user is to click on the unidentified menu item, I would retrieve the string from the clicked menu item then search for the window using FindWindow then do whatever I wish with the selected window. But at this point I can't figure out what went wrong :icon_rolleyes: Do you have any possible ideas/clues? :sad: Thanks, a lot! :ooh: |
Re: A menu issue -
Thanks for attempting to use code tags, but next time don't put any spaces in them. You had the right characters, you just can't have any spaces between the brackets.
You probably should learn to use your compiler's debugger. I know Dev-C++ has one, but I don't know how to use it either. Search Dev-C++'s forums and you will probably find that information. Here is a good place to start. |
Re: A menu issue -
gdb is quite easy to use. All I know how to do is type "up" at the prompt but that is often enough to find the problem with my code. I code on Mac OS X, but I believe there is a Windows port available.
|
Re: A menu issue -
Well, first of all I use Borland C++ Builder 6 ;) secondly I don't know how to use a debugger :( And finally I am not sure it can help, because the code has runtime ISSUES and not problems(a debugger detects problems not issues(there is a slight difference)), by issues I am refering to the way something is coded...
Any ideas? Thanks. |
Re: A menu issue -
>>secondly I don't know how to use a debugger
Learn. Its your program and your problem, now ours. If you are going to write programs them you must learn how to debug them. debuggers will also help sort out issues as you like to call them. |
Re: A menu issue -
Well I guess I'll look for information in the time... Maybe its worth mensioning that the menu is not used using SetMenu() because my program is a tray icon and instead I use TrackMenuPopup()...
Any ideas? Thanks. |
| All times are GMT -5. The time now is 3:49 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC