Windows programming win32 - winapi

I am trying to get menu/submenu name on mouse left click.For this i need to get some notification when i click on that particular menu/submenu.Look if somebody has the idea to do that?

Instead of reacting to WM_LBUTTONDOWN for a menu, you should instead listen for the WM_COMMAND notification. Windows takes care of all the details of handling mouse movement and clicks within menus.

To work with menu/submenu there is a totally different WMs is
Look in MSDN for this WM_MENUSELECT for example

Related

Simulate mouse hover in windows application using win32 api

With a game application (may have been minimized or hidden), I have a button that only shows up when I hover over it. I need to write an script (by c# or python) that can click that button without moving my cursor. I was able to simulate click event with SendMessage(hWnd, WM_LBUTTONDOWN, ...), but i don't know how to make that button show up.
I have seen a tool that can do it, I don't know how they do it.
My problem seems similar to this problem.
I won't need SendInput or mouse_event because it will move my cursor.
Any one can help? Is there another unrelated way?

How to know if a button from another application is clicked or not

I need to automate a task with AutoIt script. Target application is "YTD Video downloader". It has a download button. When i click this button, i need my autoit script to start. After a few hours of googling, i understand that i need to use "SetWindowsHookEx" API. But wetting my toe into it, i want to read some example code or some tutorials on this purticular subject. I have googled a lot for finding such tutorials. Every tutorials are related to either keyboard hook or mouse hook. I can't find how to use this api for a button is clicked or not. Please help me. Thanks in advance.
Note: What i have learned yet about SetWindowsHookEx is;
Use "UnHookWindowsEx" when you exit your program.
Is that the only one thing i noticed when doing this ?
Use a spy program like Spy++ to see which messages are being sent by your target application when the button is clicked. There is probably a WM_COMMAND being sent from the download button to its parent window; this is probably the right message to intercept with SetWindowsHookEx.
There are some examples of this around Stack Overflow e.g. here

VC++ mouse events

I want to write a console program for mouse events (Only mouse scroll). How do I do it in VC++? The application will listen only to scroll events.
Description: If the user scrolls down, the Desktop window fades down, and fades-in when user scrolls up.
Here I just need to know to to listen to mouse events in console app.
Note: I am developing using win32 API, and for development environment I am using VS2010.
I've never actually done this myself. It seems that a console application responding to mouse events almost belies its nature and intended purpose. Generally, you would only need to respond to keyboard input from a console app and leave the mouse stuff to a GUI app.
That being said, this tutorial indicates that it is in fact possible to capture these mouse events from a Win32 console application. Generally, the suggestion is to use the ReadConsoleInput function and extract the information of interest from the INPUT_RECORD structure that it fills. The only tricky thing is that the call to ReadConsoleInput is a blocking call, which means it will not return until there is an input event fired. You'll need to structure your application's code accordingly. Mouse events are covered in detail about 3/4 of the way down the page.

Non-modal notification bars?

How can I implement a non-modal sliding notification bar, such as Firefox, Beyond Compare, and VMware Workstation 6.5 use, in client-side Windows apps?
Any language or framework is fine for now; my current app is in Delphi / C++Builder, but I'm also interested in comparing frameworks and prototyping some UIs.
Related question: This question asks about doing so in Java.
Beyond Compare's notification bar doesn't slide, it just pops open, so I can't offer any help on that. The notification bar itself is just a TPanel with a TImage and TLabel for the image/text. It's placed on the main window at design time and it's set to align bottom. Normally it's hidden, and when there's a message to display we set the Visible property to true.
There's different ways to hide the notification, depending on how you want it to behave. In BC we install keyboard and mouse hooks (SetWindowsHookEx with WH_KEYBOARD or WH_MOUSE) and hide it on key up and mouse button events. Alternatively, like Mark said, you could hide it after a delay, add a close button to the side, or just watch for specific events in your app and manually hide it then.
In Delphi, I believe that you can change a property on the Dialog itself (change the window type away from "Dialog" and select the standard windowed alternative). Sorry I cannot be more specific, it has been about two years since I last worked on a Delphi app.

Is a mouse click a WM_* message or a combination of up & down messages?

I'm used to working with a Windows framework that provides events for things like a mouse click or a mouse double click. Are click events a Windows construct (i.e. does Windows send a WM_DOUBLECLICK or similar message) or does it send WM_MOUSEDOWN and WM_MOUSEUP to applications which then do some math to decide if the event was a click or otherwise?
According to MSDN documentation The correct order of messages you will see for double click event are - WM_LBUTTONDOWN, WM_LBUTTONUP, WM_LBUTTONDBLCLK, and WM_LBUTTONUP
It's a combination of messages sent through the WindowProc(). The messages are WM_LBUTTONDOWN, WM_LBUTTONDBLCLK, WM_LBUTTONUP for the left mouse button, WM_MBUTTONDOWN and so forth for the middle button, and WM_RBUTTONDOWN and so forth for the right mouse button. See the Windows SDK at MSDN for more info.
A mouse click is not a combination of windows messages, but it can lead to, depending on the application that is clicked.
There is a huge difference between windows input and windows messages, as they are only a tool for some applications, used in many different ways, as explained on MSDN:
About Mouse Input
System Events and Mouse Messages
I also provided an example that shows the difference clearly in my question How could it work to use multiple cursors on one Windows client? It shows what messages are sent by clicking and that windows messages are often not enough to emulate a mouse click, but if they are, how they can be used.

Resources