left click, right click, double click
hi everyone, i'm really new to C so please bear with me here. i am trying to make a simple app where you click on the form/main page and an external application is launched (let's call this C:\1.exe). when you double click, another application is launched (C:\2.exe). and finally when you right click, a third application (C:\3.exe) is launched. how is it possible to do this? i hope this is not too complicated. thanks in advance.
Re: left click, right click, double click
1. Create message handlers for WM_LBUTTONDOWN (or WM_LBUTTONUP), WM_LBUTTONDBLCLK, WM_RBUTTONDOWN (or WM_RBUTTONUP).
2. Use ::CreateProcess API to launch external programs.
Re: left click, right click, double click
thanks. this works great.
Re: left click, right click, double click
Food for thought....
When you get on to building more complex applications with context menus, you'll want to handle WM_CONTEXTMENU rather than WM_RBUTTONDOWN.
The reason is you can display a context menu with the SHIFT + F10 keyboard command. If you only handle a WM_RBUTTONDOWN, the context menu can't be invoked from the keyboard.
If you use WM_CONTEXTMENU, it will work for the right mouse click and keyboard.
Re: left click, right click, double click
[QUOTE=VictorN;2025343]1. Create message handlers...QUOTE]
Hi Victor thanks for using message handlers instead of events handlers.
It makes things much easier to comprehend.
Re: left click, right click, double click
Quote:
Originally Posted by
JohnCz
Hi Victor thanks for using message handlers instead of events handlers.
It makes things much easier to comprehend.
Hi John,
no problem, it is how I learned it... ;)