View Full Version : Break when a particular menu item is clicked
Anonymous
October 6th, 2003, 22:16
I have a program that im debugging, im trying to break when I click on a particular menu item. At the moment ive got it breaking at CreatePopupMenu, and I can then see all the calls to AppendMenu. Does anyone know how to set up some sort of conditional breakpoint so that it only breaks when I hit the particular menu entry that Im after?
Many thanks in advance
Anonymous
October 6th, 2003, 23:11
Me again. To elaborate, I know that the WM_COMMAND message is sent when a menu is clicked, and that the low word in wparam is the ID of the menu. So if I could somehow set up a conditional breakpoint to do that, thatd be great. But what would the expression be? Something like this should work: MSG==WM_COMMAND && LOWORD(WPARAM)==1234 (where 1234 is the menu id)
But the loword/wparam bit isnt valid, anyone know how to do that?
Anonymous
October 7th, 2003, 05:24
Well, turn on debugging, recompile the program and the compiler will tell you the address of the routine that will be called when the menu item is selected, just create a break here.
If you don't have access to the source code, then your obviously trying to crack someone elses program, in which case, you should leave. now.
Anonymous
October 7th, 2003, 06:07
> If you don't have access to the source code
Correct, I don't.
> then your obviously trying to crack someone elses program
No, I'm not, and that's a very silly assumption - if you think using debuggers is only about cracking then maybe it's you that's the cracker.
I have a program that I use regularly that works fine under all OS's, but for some reason one of the menu functions does nothing when I click on it when running it on my NT box, but it works fine on my Win2K box, so I'm trying to find out where it's falling over, then maybe I'll be able to work around it.
I thought this was the right forum to ask debugger-related questions about OllyDbg, but never mind, i'll ask elsewhere. Thanks anyway.
Powered by vBulletin® Version 4.2.2 Copyright © 2018 vBulletin Solutions, Inc. All rights reserved.