AutoHotkey Community

It is currently May 27th, 2012, 3:02 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 42 posts ]  Go to page Previous  1, 2, 3
Author Message
 Post subject:
PostPosted: March 19th, 2010, 4:53 am 
thanks man. even passing the correct lParam is still giving my vista/win7 users using Aero problems, the window is getting resized to the minimum width or something stupid and i'm on XP so cant really debug.

anyway, since you're good with this bit shifting stuff, i'm curious if i'm passing WM_LBUTTONDOWN/UP lParams the best way.

from msdn:
http://msdn.microsoft.com/en-us/library ... 85%29.aspx

Quote:
WM_LBUTTONDOWN Message
lParam
The low-order word specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.
The high-order word specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.


and i'm using this, which seems to work:

Code:
WM_LBUTTONUP := 0x202
PostMessage, WM_LBUTTONUP, 0, ((y<<16)^x), , ahk_id%win%


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 19th, 2010, 5:19 am 
also, would my win7 users have this problem because its 64bit OS? does that change the var capacities or something?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 19th, 2010, 6:04 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
guest3456 wrote:
even passing the correct lParam is still giving my vista/win7 users using Aero problems, the window is getting resized to the minimum width or something stupid and i'm on XP so cant really debug.
Actually I'm on 64-bit Win7 (Ultimate) with Aero on, and I just tested and there was no problem in resizing the window (:even if I just used 0 as lParam).

BTW, recall that
Sean wrote:
POINTS (which is nothing but a means to pack x/y into INT32)
meaning that the following is merely another way of saying that lParam is a (ByVal) POINTS struct, in essence, as lParam is of INT32/64 for a 32/64-bit app.
Quote:
WM_LBUTTONDOWN Message
lParam
The low-order word specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.
The high-order word specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

So, use
Code:
(x & 0xFFFF) | (y & 0xFFFF) << 16

Although ^ will produce identical results as with | in this case, I recommend | over ^.

Quote:
would my win7 users have this problem because its 64bit OS? does that change the var capacities or something?
AHK is still a 32-bit app, even in 64-bit OS, where it's working through WOW64 emulator. OTOH, even with a 64-bit app, as SHORT/WORD is of fixed size of 2-bytes, POINTS still will be of 4-bytes.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 19th, 2010, 3:13 pm 
Sean wrote:
meaning that the following is merely another way of saying that lParam is a (ByVal) POINTS struct, in essence, as lParam is of INT32/64 for a 32/64-bit app.

So, use
Code:
(x & 0xFFFF) | (y & 0xFFFF) << 16

Although ^ will produce identical results as with | in this case, I recommend | over ^.


gotcha thanks

Sean wrote:
guest3456 wrote:
even passing the correct lParam is still giving my vista/win7 users using Aero problems, the window is getting resized to the minimum width or something stupid and i'm on XP so cant really debug.
Actually I'm on 64-bit Win7 (Ultimate) with Aero on, and I just tested and there was no problem in resizing the window (:even if I just used 0 as lParam).


blah wtf :( are you sending the LBUTTONUP as well? heres exactly what i'm doing:

Code:
f1::
   MouseGetPos,,, win
   WinMove, ahk_id %win%,,,, 853, 615

   PostMessage, 0xA1, 11, 0, , ahk_id%win%
         ;WM_NCLBUTTONDOWN  = 0xA1
         ;HTRIGHT = 11       (right border)

   PostMessage, 0x202, 0, 0, , ahk_id%win%
         ;WM_LBUTTONUP  =  0x202
return


then users were reporting that tables were getting sized small, which i suspected was due to sending 0 to lParam (coord 0x0 ?) so then i've tried sending the coord to each message, which caused this whole thread:

Code:
f2::
   SysGet, xborder, 32
   SysGet, yborder, 33
   SysGet, caption, 4

   MouseGetPos,,, win
   WinMove, ahk_id %win%,,,, 853, 615
   sleep, 100
   WinGetPos, xx, yy, ww, hh, ahk_id %win%

   borderpoint_client_x := ww-xborder-2
   borderpoint_client_y := 20
   
   borderpoint_screen_x := xx+xborder+borderpoint_client_x
   borderpoint_screen_y := yy+yborder+caption+borderpoint_client_y
   
   ;msgbox, xboC=%borderpoint_client_x%`nyboC=%borderpoint_client_y%`nxboS=%borderpoint_screen_x%`nyboS=%borderpoint_screen_y%
    

      WM_NCLBUTTONDOWN := 0xA1      ;http://msdn.microsoft.com/en-us/library/ms645620%28VS.85%29.aspx
      HTLEFT := 10
      HTRIGHT := 11              ;right border
      HTBOTTOMRIGHT := 17
   PostMessage, WM_NCLBUTTONDOWN, HTRIGHT, borderpoint_screen_x|borderpoint_screen_y<<16, , ahk_id%win%
     
      WM_LBUTTONUP := 0x202
   PostMessage, WM_LBUTTONUP, 0, ((borderpoint_client_y<<16)^borderpoint_client_x), , ahk_id%win%
    
return


then i was getting reports of minsizes and other random sizes, related to where in the window the mouse cursor is when they press the hotkey. mouse on right side of window leads to minsize, mouse on left size resizes bigger. (which leads me to my original assumption relating to mouse cursor location, but apparently sending these coords isnt fixing it)

and once my one tester turns on Basic mode with no Aero, all these codes work :( (so maybe its not doing some other mouse pos check in basic?)

so it seems for now i'm gonna have to do some BS like:

Code:
   MouseGetPos, oldx, oldy, win
   Click %x%, %y%
   MouseMove, %oldx%, %oldy%, 0


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 19th, 2010, 4:34 pm 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
No, I didn't send WM_LBUTTONUP. BTW, what's the purpose of sending these messages? What's not enough with WinMove?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 19th, 2010, 5:47 pm 
i'm trying to resize a game window. this game only allows a certain width/height proportion. so it propbably expects it will only resize when a user drags the border, and then it will rescale itself and redraw. but even if i WinMove the correct proportion, it still doesnt redraw itself. however, if i WinMove, then simply click the border manually with my mouse, it will rescale to its proper proportions, and then redraw.

i've tried all the normal methods, WinMove, Winset Redraw, WinHide, RedrawWindow, UpdateWindow, InvalidateRect. no dice. so i figured i'd try to do exactly what happens when i click the border. first i tried WM_ENTERSIZEMOVE which didnt work. then i found NCLBUTTONDOWN and i'm getting close


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 19th, 2010, 5:54 pm 
some visuals

normal window:
http://img195.imageshack.us/img195/1386/34693947.jpg

WinMove:
http://img195.imageshack.us/img195/1406/12661596.jpg

simply click once on the border:
http://img205.imageshack.us/img205/158/72923227.jpg


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 19th, 2010, 7:30 pm 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
I see. I suggest to use the command Click instead of WM_LBUTTONUP.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 19th, 2010, 8:53 pm 
yeah, i'm just using Click in place of both NCLBUTTONDOWN and LBUTTONUP. the reason why i wanted to use those messages though, is because i didnt want to move the mouse and move it back. things could get dicey if a hotkey dependent upon mouse position is sent to the wrong place in the midst of one of these resize border clicks


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 20th, 2010, 1:54 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
Then, what happens if you use M/R(BUTTON) instead of L? Or what if use WM_NCLBUTTONDBLCLK? I suggest it as it doesn't require WM_LBUTTONUP.
Code:
PostMessage, 0xA3, 11, 0, , ahk_id %win%


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 22nd, 2010, 1:12 am 
ill give it a shot and send it to my tester


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 29th, 2010, 4:10 am 
Sean wrote:
Then, what happens if you use M/R(BUTTON) instead of L? Or what if use WM_NCLBUTTONDBLCLK? I suggest it as it doesn't require WM_LBUTTONUP.
Code:
PostMessage, 0xA3, 11, 0, , ahk_id %win%


havent heard back from people, but didnt even think to try on my XP, just did, and its not working :?


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 42 posts ]  Go to page Previous  1, 2, 3

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google [Bot], rbrtryn and 30 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group