Re: Re: Getting mouse click info form a non Gui4Cli window.
Dimitris Keletsekis <[email protected]> Mon, 8 Apr 2013 09:38:34 +0300
| Newsgroups | gmane.comp.windows.gui4cli |
|---|---|
| Message-ID | <CAHiKg1Wb_HnHZvBSW8v09iyUyKm=JnGg9NcLuCFZ9jGNR5_X-w@mail.gmail.com> |
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 <[email protected]>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 > > > > > > > > > > > > > > > > > > >