I want to write a program in which the main form will transparent to mouse, but the requirement is: when I click on the form, it will turn transparent and let the mouse click through it, but when I drag the mouse, the form will not be transparent so that I can draw on it.
I found many articles teaching how to make a transparent form to mouse by using layered window with ModifyStyleEx and WS_EX_TRANSPARENT bit turned on. But when I press the mouse down, the form looses focus so I cannot catch whenever the mouse is clicked or dragged.
Does anyone have an idea?
Thanks in advance.
Here is a tip, I haven't tried it! Maybe you should play around by handling the WM_NCHITTEST window message in your program. You can return HTTTRANSPARENT or whatever you want, can pass the message handling to the default window proc, whatever you want. Whit this you may manage to handle mouse messages. Making the form opaque/transparent is another task on top of input handling, you can find lots of tutorials on how to do that correctly.
In my project, a batch file should be first started to launch cmd windows, as well as initializing some parameters and some background processes. in the cmd windows,my own calculation processes could be started by typing the exe name directly. Now, i've written a MFC application program, and want to implement my calculaiton processes in a dialog button. I want to use ShellExecute where the first paramter is the cmd window handle i've got. Can anybody tell me how to write the shellexexute to post a command line to an existing cmd windows.
Another option is changing your design to use a master application instead of the batch file that starts all necessary processes where the master application and the processes use some kind of Interprocess Communications[^].
Posted when the user double-clicks the left mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
The message is probably send to a child window of your main frame window (e.g. a view window).