| 
		
	
	
	
		
	Posts: 20Threads: 6
 Joined: Jul 2010
 
	
	
		Hello QM Forum,
 I was wondering if its possible to use QM to get the XY cords when my mouse clicks and out them? So I could turn them into code like: lef 302 401 "I.E"?
 Please dont mistake this as a key logger I dont want anything like that, just as a preference setting for windows that cannot be clicked with other calls besides mouse clicks. So it can be universal instead of only working on my computer. Thanks for your time its much appreciated.
 
	
	
	
		
	Posts: 12,239Threads: 144
 Joined: Dec 2002
 
	
	
	
		
	Posts: 20Threads: 6
 Joined: Jul 2010
 
	
	
		Thank you, sorry about not checking to see if posts existed before asking. Wasnt really to sure what to search for though.
	 
	
	
	
		
	Posts: 20Threads: 6
 Joined: Jul 2010
 
	
	
		ok I found this code you had, I tried messing with it a bit but cant get the result I desire. I only want it to out the x y if i lef click. but this code outs and then ends every time i just move my mouse and Im not really sure how to edit it to work how I need it to. Will you make me an example please? 
Macro Macro1276 KBDLLHOOKSTRUCT ksMSLLHOOKSTRUCT ms
 int k=WaitForKeyOrMouse(0 ks ms)
 ;out k
 str what action
 if(k<256) ;;key
 ,qm.FormatKeyString k 0 &what
 ,action=iif(ks.flags&LLKHF_UP "released" "pressed")
 ,
 ,out "key %s %s" what action
 else ;;mouse
 ,sel k
 ,,case [WM_LBUTTONDOWN,WM_LBUTTONUP] what="left"
 ,,case [WM_RBUTTONDOWN,WM_RBUTTONUP] what="right"
 ,,case [WM_MBUTTONDOWN,WM_MBUTTONUP] what="middle"
 ,,case [WM_XBUTTONDOWN,WM_XBUTTONUP] sel(ms.mouseData>>16) case XBUTTON1 what="X1"; case XBUTTON2 what="X2"
 ,,case WM_MOUSEMOVE what="move"
 ,,case WM_MOUSEWHEEL what="wheel"; action=iif(ms.mouseData>>16&0x8000 "backward" "forward")
 ,sel k
 ,,case [WM_LBUTTONDOWN,WM_RBUTTONDOWN,WM_MBUTTONDOWN,WM_XBUTTONDOWN] action="pressed"
 ,,case [WM_LBUTTONUP,WM_RBUTTONUP,WM_MBUTTONUP,WM_XBUTTONUP] action="released"
 ,
 ,out "mouse %s %s at %i %i" what action ms.pt.x ms.pt.y
 
	
	
	
		
	Posts: 12,239Threads: 144
 Joined: Dec 2002
 
	
	
		also look in AltMouseTriggers
	 
	
	
	
		
	Posts: 20Threads: 6
 Joined: Jul 2010
 
	
	
		Do I look it up in MSDN Library or does QM have reference about it?
	 
	
	
	
		
	Posts: 12,239Threads: 144
 Joined: Dec 2002
 
	
	
		It is in the search results. Click the link again and you will find it.
	 
	
	
	
		
	Posts: 20Threads: 6
 Joined: Jul 2010
 
	
	
		Ok great, I figured out what I need to do.
 Is is possible to make an if statement so i can end the constant running thread if the window is single lef clicked?
 
 what I want to do is have it check like this.
 
 if(lef mouse click occurs) end
 
 using this code case [WM_LBUTTONDOWN,WM_LBUTTONUP]to check if the mouse has been clicked.
 
	
	
	
		
	Posts: 12,239Threads: 144
 Joined: Dec 2002
 
	
	
		,case WM_LBUTTONDOWN,end
 
	
	
	
		
	Posts: 20Threads: 6
 Joined: Jul 2010
 
	
	
		Ok ive gotten the code to this much it works how I want except its still ending without me clicking? What am I missing? I have all the member functions in file just didnt think need to post let me know and I will post them as well. 
Macro Macro KBDLLHOOKSTRUCT ksMSLLHOOKSTRUCT ms
 int k=WaitForKeyOrMouse(0 ks ms)
 
 sel k
 ,case WM_LBUTTONDOWN
 ,out "%i %i" ms.pt.x ms.pt.y
 ,end
 
	
	
	
		
	Posts: 12,239Threads: 144
 Joined: Dec 2002
 
	
	
		Gintaras Wrote:,case WM_LBUTTONDOWN,end
 
It is in AltMouseTriggers.
 
I don't recommend to use WaitForKeyOrMouse. Would need to goto beginning on case else, but it is much overhead.
 
----------------
 
If need only single click: 
Macro Macro1423 
	
	
	
		
	Posts: 20Threads: 6
 Joined: Jul 2010
 
	
	
		Ok I looked for AltMouseTriggers and this is what I found:AltMouseTrigger help 
I got the code off the page that was there but wasnt really sure how to use it, this is my first time going indepth with mouse click actions, would you mind making me a small example of how to use AltMouseTriggers?
	 
	
	
	
		
	Posts: 12,239Threads: 144
 Joined: Dec 2002
 
	
	
		Need hooks only if you need all clicks. 
If need 1 click, use this:
 
Macro Macro1423 
	
	
	
		
	Posts: 20Threads: 6
 Joined: Jul 2010
 
	
	
		Ok thats good I only need the 1 mouse click to get the x y, but how can i get xy without: 
Function Function out "%i %i" ms.pt.x ms.pt.y
Because when I run the code with wait 0 ML it outs 0 0 like the x y's are not registering?
	 
	
	
	
		
	Posts: 12,239Threads: 144
 Joined: Dec 2002
 
	
	
		Macro Macro1423 wait 0 MLout "%i %i" xm ym
 
	
	
	
		
	Posts: 20Threads: 6
 Joined: Jul 2010
 
	
	
		Thank you I appreciate the help very much. Sorry for taking so long to figure out exactly what i needed.
	 |