|
-
July 21st, 2011, 02:07 AM
#1
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.
-
July 21st, 2011, 02:32 AM
#2
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.
Victor Nijegorodov
-
July 21st, 2011, 02:56 PM
#3
Re: left click, right click, double click
thanks. this works great.
-
July 21st, 2011, 07:48 PM
#4
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.
-
July 23rd, 2011, 11:27 AM
#5
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.
There are only 10 types of people in the world:
Those who understand binary and those who do not.
-
July 23rd, 2011, 03:34 PM
#6
Re: left click, right click, double click
 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...
Victor Nijegorodov
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|