Re: Getting mouse click info form a non Gui4Cli window.
"chris.kevany" <[email protected]> Mon, 08 Apr 2013 21:33:19 -0000
| Newsgroups | gmane.comp.windows.gui4cli |
|---|---|
| Message-ID | <[email protected]> |
--- In [email protected], Dimitris Keletsekis <gui4cli@...> wrote: > > From what I see you are not handling the nCode value and calling > CallNextHookEx() if its negative, etc.. That's often the problem with example codes from the internet. They are very basic :) I still have the old Win32 docs in the old help format but I remember CallNextHookEx() was mentioned. Have to take a closer look at that. I actually want to use it for FFplay which is FFmpeg that puts its output to a video window instead of a file to disk. It has very limited control but it's great to check out in real time how certain FFmpeg settings turn out. I run it with CreateProcess() with the console hidden so only the video window shows up. I have the handle of the console and I assume the video window is a child process of that. Perhaps I can do something more direct with that. Thanks, Chris --- In [email protected], Dimitris Keletsekis <gui4cli@...> wrote: > > Since you are filtering the mousemove messages and using only the mouse > clicks, you shouldn't have any noticeable delay. The system is way too fast > to be slowed down by such stuff. > > From what I see you are not handling the nCode value and calling > CallNextHookEx() if its negative, etc.. > > Maybe that's the problem. > > Dimitris > > > On Sun, Apr 7, 2013 at 10:17 PM, chris.kevany <chris.kevany@...>wrote: > > > ** > > > > > > --- In [email protected], Dimitris Keletsekis <gui4cli@> wrote: > > > > > > Looks fine - does it work well ? > > > > > > > Well, basically it does but what worries me is the delay. > > The low level option generates huge amounts of mouse move messages > > at the callback. It seems that the high level option doesn't do > > that or handles it better. > > > > I normally can smoothly move the mouse pointer during the gui startup. > > With this code included mouse movement stutters. There's also some > > delay when I exit the gui. > > But when I look at the Windows task manager, the CPU usage looks > > normal or is at least not extremely high. > > > > --- In [email protected], Dimitris Keletsekis <gui4cli@> wrote: > > > > > > Looks fine - does it work well ? > > > > > > > > > On Sun, Apr 7, 2013 at 12:07 PM, chris.kevany <chris.kevany@>wrote: > > > > > > > ** > > > > > > > > > > > > Hi Dimitris, > > > > > > > > > > Thanks for the suggestion! > > > > > > > > I googled a bit on about this function to get some source code > > examples. > > > > There's a low level (WH_MOUSE_LL) and a high level (WH_MOUSE) variant > > for > > > > it. > > > > > > > > These two are a bit controversal in the sense that the low level > > variant > > > > has a noticable delay on overal performance of the gui. It acts system > > wide > > > > so I can call up a quickmenu on the external window. It supports all > > mouse > > > > button clicks except double-click. > > > > > > > > The high level variant also supports double click but unfortunately it > > is > > > > only seen by the calling thread (Gui4Cli). Useless as you can guess > > because > > > > Gui4Cli already has much better support built-in for this. > > > > > > > > I used this ... > > > > > > > > BOOL _export WINAPI DLL_Init (struct GCMain *gcmain) > > > > { > > > > GCM = gcmain; // store the pointer to Gui4Cli's main structure.. > > > > > > > > gcAddCommands(DLL_COMMANDS); // add commands to GUI dll list > > > > > > > > > > > > > > SetWindowsHookEx(WH_MOUSE_LL,MouseHookProc,GetModuleHandle("dll_name.dll"),0); > > > > > > > > return TRUE; > > > > } > > > > > > > > void WINAPI DLL_Free (void) > > > > { > > > > UnhookWindowsHookEx(MouseHook); > > > > } > > > > > > > > and the callback ... > > > > > > > > HHOOK MouseHook; > > > > > > > > LRESULT CALLBACK MouseHookProc(int nCode, WPARAM wParam, LPARAM lParam) > > > > { > > > > > > > > PKBDLLHOOKSTRUCT k = (PKBDLLHOOKSTRUCT)(lParam); > > > > POINT p; > > > > > > > > struct Event * bt; > > > > int retval; > > > > > > > > if(wParam == WM_RBUTTONDOWN) > > > > { > > > > GetCursorPos(&p); > > > > > > > > bt = gcFindEvent("gui_name","right_click", retval); > > > > > > > > gcTriggerEventWait(bt); > > > > } > > > > return 0; > > > > } > > > > > > > > and in the gui ... > > > > > > > > xRoutine right_click > > > > use win 'External Window title' > > > > if $$win.active = 1 > > > > quickmenu -1 -1 'First Item/Second Item/#sepa/Cancel' > > > > if $$choice = 0 > > > > say 'Item 1 selected' > > > > elseif $$choice = 1 > > > > say 'Item 2 selected' > > > > endif > > > > endif > > > > > > > > The "GetAsyncKeyState(0x02)" function could also be used from within > > > > a timer, polling for a mouse button press. > > > > > > > > Chris > > > > > > > > > > > > --- In [email protected], Dimitris Keletsekis <gui4cli@> wrote: > > > > > > > > > > I googled and found this function: > > > > > > > > > > SetWindowsHookEx (using the WH_MOUSE_LL flag) > > > > > > > > > > Looks like the one to use. > > > > > Dimitris > > > > > > > > > > > > > > > > > > > > On Sat, Apr 6, 2013 at 7:55 PM, chris.kevany chris.kevany@ wrote: > > > > > > > > > > > ** > > > > > > > > > > > > > > > > > > > > > > Hi Dimitris, > > > > > > > > > > > > I'm currently controlling a non Gui4Cli window on its title with > > > > > > the "use" command which works great. > > > > > > > > > > > > This is a one direction control from Gui4Cli to the external > > window. > > > > > > I now would like to retrieve mouse click info from the external > > window > > > > > > in Gui4Cli. > > > > > > > > > > > > My basic idea is to create a ddl function that catches mouse clicks > > > > > > at the external window and triggers a Gui4cli event. > > > > > > > > > > > > Do you have any suggestions? > > > > > > > > > > > > Chris > > > > > > > > > > > > > > > > > > > > > > > > > > > > ------------------------------------ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/gui4cli/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/gui4cli/join (Yahoo! ID required) <*> To change settings via email: [email protected] [email protected] <*> To unsubscribe from this group, send an email to: [email protected] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/