1
2 // Поиск окна находящегося сверху данной точки экрана
3 func uint gettopwindow( uint wd POINT pnt )
4 {
5 POINT pntcl //Координаты переведенные под текущее окно
6 uint /*wd,*/ ww, wp, wc
7 uint flgtr
8
9 //Инициализация, окно экрана
10 //wd = GetDesktopWindow()
11 wc = wd
12 ww = 0
13 flgtr = $CWP_SKIPTRANSPARENT
14 //Получение первого потомка
15 while wc && wc != ww
16 {
17 pntcl = pnt
18 ScreenToClient( wc, pntcl )
19 wp = ww
20 ww = wc
21 wc = ChildWindowFromPointEx( wc, pntcl.x, pntcl.y, $CWP_SKIPINVISIBLE | flgtr )
22 flgtr = 0
23 }
24 /*
25 if wp != wd
26 { //Поиск потомка лежащего сверху
27 ww = GetWindow( ww, $GW_HWNDLAST )
28 while ww
29 {
30 print( "ww=\(ww)\n" )
31 if GetWindowLong( ww, $GWL_STYLE ) & $WS_VISIBLE
32 {
33 pntcl = pnt
34 ScreenToClient( ww, pntcl )
35 wc = ChildWindowFromPointEx( ww, pntcl.x, pntcl.y, $CWP_SKIPINVISIBLE )
36 if wc: break;
37 wc = ww
38 }
39 ww = GetWindow( ww, $GW_HWNDPREV )
40 }
41 }*/
42 return ww
43 }
44
45 func setrgn( uint w, RECT r )
46 {
47 uint ar, br
48 int mx, my, hx, hy
49 subfunc sm( int x, int y )
50 {
51 SetRectRgn( br, x, y, x + 6, y + 6 )
52 CombineRgn( ar, ar, br, $RGN_OR )
53 }
54 //flgnopaint = 1
55 //ShowWindow( w, $SW_HIDE )
56 //SetWindowLong( w, $GWL_STYLE, GetWindowLong( w, $GWL_STYLE ) & ~ $WS_VISIBLE )
57 //SetWindowRgn( w, 0, 1 )
58 ////SetWindowRgn( w, 0, 1 )
59 //MoveWindow( w, 0, 0, 0, 0, 1 )
60 //ShowWindow( w, $SW_HIDE )
61 //MoveWindow( w, 0, 0, 0, 0, 1 )
62 //SetWindowPos( w, 0, 0, 0, 1, 1, $SWP_NOMOVE | $SWP_NOACTIVATE | $SWP_NOSENDCHANGING)
63
64 //SetWindowRgn( w, 0, 0 )
65
66 mx = r.right - r.left
67 my = r.bottom - r.top
68 hx = mx / 2 - 1
69 hy = my / 2 - 1
70 ar = CreateRectRgn( 2, 2, mx + 2, my + 2 )
71 br = CreateRectRgn( 4, 4, mx, my )
72 CombineRgn( ar, ar, br, $RGN_DIFF )
73 mx -= 2
74 my -= 2
75 sm( -0, -0 )
76 sm( hx, -0 )
77 sm( mx, -0 )
78 sm( -0, hy )
79 sm( mx, hy )
80 sm( -0, my )
81 sm( hx, my )
82 sm( mx, my )
83 //uint br = CreateRectRgn( 2, 2, r.right - r.left - 2, r.bottom - r.top - 2 )
84
85 DeleteObject( br )
86 //flgnopaint = 0
87 //ShowWindow( w, $SW_HIDE )
88 SetWindowRgn( w, ar, 1 )
89
90 MoveWindow( w, r.left - 2, r.top - 2, r.right - r.left + 4, r.bottom - r.top + 4, 1 )
91 //ShowWindow( w, $SW_SHOW )
92 //InvalidateRgn( w, ar, 1 )
93 //UpdateWindow( w )
94 //Sleep(1000)
95 /*print( "setrgn
96 \(r.right - r.left + 4)
97 \(r.bottom - r.top + 4)
98 \n" )*/
99
100 //ShowWindow( w, $SW_SHOW )
101 //Sleep(1000)
102 //InvalidateRect( w, 0->RECT, 1 )
103
104 //ShowWindow( w, $SW_SHOW )
105 //SetWindowLong( w, $GWL_STYLE, GetWindowLong( w, $GWL_STYLE ) | $WS_VISIBLE )
106 }
107
108 func uint getcursorsize( uint w, POINT pnt )
109 {
110 RECT r
111 int mx, hx, my, hy
112 uint res = 0
113 GetWindowRect( w, r )
114 mx = r.right - r.left - 6
115 hx = mx/2
116 my = r.bottom - r.top - 6
117 hy = my/2
118 if pnt.y >= my
119 {
120 if pnt.x >= mx : res = 5
121 elif pnt.x >= hx && pnt.x < hx + 6 :res = 8
122 elif pnt.x < 6 : res = 6
123 }
124 elif pnt.y >= hy && pnt.y < hy + 6
125 {
126 if pnt.x >= mx : res = 7
127 elif pnt.x < 6 : res = 3
128 }
129 elif pnt.y < 6
130 {
131 if pnt.x >= mx : res = 2
132 elif pnt.x >= hx && pnt.x < hx + 6 : res = 4
133 elif pnt.x < 6 : res = 1
134 }
135 return res
136 }
137
138 func mousetopoint( uint lpar, POINT pnt )
139 {
140 pnt.x = int( ( &lpar )->short )
141 pnt.y = int( ( &lpar + 2 )->short )
142 }
143
144 /*
145
146
147
148 func ffr( uint w, x, y )
149 {
150 MoveWindow( w, x-2, y-2, 5,5, 1 )
151 }
152
153 func outnamewin( uint wp )
154 {
155 str c, b
156 c.reserve( 256 )
157 GetClassName( wp, c.ptr(), 256 )
158 c.setlenptr()
159 b.reserve( 256 )
160 SendMessage( wp, $WM_GETTEXT, 256, b.ptr() )
161 b.setlenptr()
162 print( hex2stru("",wp) + " " + c + " " + b + " "+ hex2stru( "", GetWindowLong( wp, $GWL_STYLE )) +"\n" )
163 }
164 */