News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

sendmessage or postmessage to activate menu

Started by jj2007, March 02, 2008, 11:37:34 PM

Previous topic - Next topic

jj2007

I am thoroughly stuck and hope somebody can enlighten me. I want to make a standard menu drop down not when the user clicks on it, but rather when s/he moves the mouse over the menu (I once got a bad Repetitive Stress Injury and am trying to avoid mouseclicks where I can).

I tried inter alia (with parameters from the WM_NCHITTEST message):
invoke SendMessage, hWnd, WM_NCLBUTTONDOWN, wParam, addr pt
invoke SendMessage, hWnd, WM_LBUTTONDOWN, 0, lParam
to no effect. So I hoped I would be able to send the Alt keystroke, which usually activates the menu, followed by cursor down etc.

Modifying the \masm32\examples\exampl01\generic\generic.asm example, this looks as follows:

    .elseif uMsg == WM_LBUTTONDOWN

;         invoke MessageBox, hWin, chr$("you pressed a button, yeah"), ADDR szDisplayName, MB_OK

invoke PostMessage, hWin, WM_SYSKEYDOWN, VK_MENU, 0 ; activate the menu pressing the Alt Key
; invoke PostMessage, hWin, WM_SYSCHAR, VK_MENU, 0
invoke PostMessage, hWin, WM_SYSKEYUP, VK_MENU, 0

Again, no effect. I assume it is something really stupid, but I have spent my Sunday on this and would be grateful for any hint...

donkey

I think your approach here is wrong, if I was doing this I would begin with setting up a toolbar menu and use hot tracking to determine whether the mouse is over a menu. You will need a hook to process messages from the menu but that is pretty much standard.

http://msdn2.microsoft.com/en-us/library/bb775450(VS.85).aspx

I have attached an example of a menu toolbar, you will have to set up the hot tracking yourself though...

Donkey

[attachment deleted by admin]
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable