کلینیک فوق تخصصی اکسس ( کاربرد vba در اکسس )

کلینیک فوق تخصصی اکسس ( کاربرد vba در اکسس )

به اشتراک گذاری اطلاعات کسب شده در اکسس از سایت آفیس و سایت های تخصصی خارجی
کلینیک فوق تخصصی اکسس ( کاربرد vba در اکسس )

کلینیک فوق تخصصی اکسس ( کاربرد vba در اکسس )

به اشتراک گذاری اطلاعات کسب شده در اکسس از سایت آفیس و سایت های تخصصی خارجی

WM_NCHITTEST در ساب کلاس EDIT Control



تمام موارد کپی شده از داکیومنتِ موجود است  تست شده همراه با تصویر ، ثابت ها نیز از داکیومنت استخراج و قابل مشاهده برای عموم است. لینک ها شما را به مطلب داکیومنت هدایت خواهند نمود.



if the return value of the message response function of WM_NCHITTEST is HTCLIENT, indicating that the mouse clicked on the client area, Windows will send a WM_LBUTTONDOWN message to the window; if the return value of the message response function of WM_NCHITTEST is not HTCLIENT (may be HTCAPTION, HTCLOSE,

HTMAXBUTTON) Etc.), that is, when the mouse clicks on the non-client area, Windows will send a WM_NCLBUTTONDOWN message to the window.



اگر مقدار برگشتی پاسخ پیام تابع، HTCLIENT باشد، نشان می دهد که ماوس روی ناحیه Client کلیک شده . ویندوز یک پیام WM_NCLBUTTONDOWN به پنجره خواهد فرستاد اگر مقدار جواب پیام برگشتی HTCLIENT نباشد ممکن است HTCAPTION یا HTCLOSE و یا حتی HTMAXBUTTON باشد .یعنی زمان کلیک در منطقه خارج از Client ( هر پنجره ای می تواند خود باتن باشد یا کنترل ویرایش یا  دیالوگ باکس ) ویندوز یک پیام WM_NCLBUTTONDOWN به پنجره ارسال می نماید.





تصویر بالا وقتی ماوس داخل کنترل ویرایش است ( Client ) در Caption یا TitleBar عدد یک و وقتی روی بوردر است عدد 18 را مشاهده می نمائید ثابت ها در پائین ذکر شده .




Case 132 ' WM_NCHITTEST
ff = CallWindowProc(HookInputBoxprev, hWnd, uMsg, wParam, lParam)
SetWindowTextA GetParent(hWnd), ff



HTBORDER=18   '<<<<<<

HTBOTTOM=15

HTBOTTOMLEFT=16

HTBOTTOMRIGHT=17

HTCAPTION=2

HTCLIENT=1  ' <<<<<

HTCLOSE=20

HTERROR=-2

HTGROWBOX=4

HTHELP=21

HTHSCROLL=6

HTLEFT=10

HTMENU=5

HTMAXBUTTON=9

HTMINBUTTON=8

HTNOWHERE=0

HTREDUCE=8

HTRIGHT=11

HTSIZE=4

HTSYSMENU=3

HTTOP=12

HTTOPLEFT=13

HTTOPRIGHT=14

HTTRANSPARENT=-1

HTVSCROLL=7

HTZOOM=9




How to Get Border Of NonClientArea



  1. Call GetClientRect() to get the size of the client area.
  2. Call ClientToScreen() to transform client rect to screen coordinates.
  3. Call GetWindowRect() to get the rectangle of the control including NC area, in screen coordinates.
  4. Calculate difference between client rect and window rect coordinates to get size of border (e. g. leftBorderWidth = clientRect.left - windowRect.left).



how-to-set-the-size-of-the-non-client-area-of-a-win32-window-native


win32/gdi/nonclient-area



CoorDinate     ..... PtInRect





در بالا مختصات x و y با پیام WM_MOUSEMOVE و پارامتر lParam و استفاده از loword و hiword آن در Caption ذکر شده برای گرفتن Right مستطیل کنترل ویرایش از تابع GetClientRect استفاده شده.


Case WM_MOUSEMOVE
         GetClientRect GetDlgItem(hwnd, 1000), r1
         GetCursorPos tt
         ScreenToClient hwnd, tt
         mm.x = CLng(lParam And &HFFFF&)  'LoWord(lParam
         mm.y = CLng(lParam \ &HFFFF&)  'HiWord(lParam
        SetWindowTextA hwnd, "Coordinate :(" & mm.x & "," & mm.y & ")" & " &RectR:" & r1.Right & " &tt_X_Y(" & tt.x & "," & tt.y & ")"
           'r1.Left = 0: r1.Right = 30: r1.Top = 0: r1.Bottom = 50
           If PtInRect(r1, mm.x, mm.y) Then
            'SetWindowTextA GetDlgItem(hwnd, 1), "In"
           ElseIf Not PtInRect(r1, mm.x, mm.y) Then
            'SetWindowTextA GetDlgItem(hwnd, 1), "Out"
           End If


در تصویر پائین Right را 1263 زده چون از تابع GetWindowRect کنترل ویرایش با آیدی 4900 استفاده شده . در ضمن اگر ماوس در مختصات خاصی که که مستطیل را تعریف کردیم ( با left و top و right و bottom ) باشد در باتن Ok با آیدی 1 رشته In و اگر خارج باشد رشته Out جایگزین تکست پنجره باتن میشود.( استفاده از تابع PtInRect )


if Points moved inside the edit 's rectangle we specified  in the above code  , the window text of "Ok" button will  be changed to "In" , Otherwise "Out"



Byval StrPtr

"1604;1591;1601;1575;32;1601;1602;1591;32;1608;1575;1585;1583;32;1705;1606;1740;1583"



The InflateRect function increases or decreases the width and height of the specified rectangle. The InflateRect function adds -dx units to the left end and dx to the right end of the rectangle and -dy units to the top and dy to the bottom. The dx and dy parameters are signed values; positive values increase the width and height, and negative values decrease them.



تابع InflateRect عرض و ارتفاع مستطیل ( Rectangle )  را افزایش یا کاهش می دهد . این تابع dx- واحد به چپ و dx واحد به انتهای راست مستطیل و dy- به بالا و dy به پائین اضافه می نماید.پارامترهای dx و dy مقادیر علامت دار هستند .مقادیر مثبت عرض و ارتقاع را افزایش می دهند و مقادیر منفی آنها را کاهش می دهند.




Dim Mpos As POINTAPI
'Retrieves the position of the mouse cursor, in screen coordinates.
 Retval = GetCursorPos(MPos)
'Retrieves a handle to the window that contains the specified point.
hWnd = WindowFromPoint(MPos.x, MPos.y)
'A handle to the window to be tested.
 If CBool(IsWindow(hWnd)) = False Then
Label1.Caption = ""
Exit Sub
End If
Determines whether a window is maximized
IsMaximized = IsZoomed(hWnd)
'Determines whether the specified window is minimized (iconic).
IsMinimized = IsIconic(hWnd)
'Retrieves a handle to the specified window's parent or owner.
ParentWnd = GetParent(hWnd)

 




29 بهمن 1400 : در پی اهانت یک افسر هندی به سردار سلیمانی و رهبر انقلاب،  مردم منطقه بدگام کشمیر به خیابان‌ها ریختند و در حمایت از سردار سلیمانی شعار سردادند و با ماموران پلیس درگیر شدند و اقدام مامور هتاک را محکوم کردند. یکی از افسران هندی در حین عملیات سرشماری یکی از شهرهای کشمیر با ورود به منزل یکی از شهروندان عکس شهید سلیمانی و رهبرانقلاب را که در خانه او بود به آتش می‌کشد. 








گرفتن مختصات x , y زمان فشردن باتن سمت چپ ماوس روی پنجره



Function BoxProc(ByVal hWnd As LongPtr, ByVal uMsg As Long, ByVal wParam As LongPtr, ByVal lparam As LongPtr) As LongPtr

Case WM_LBUTTONDOWN

       Dim p As POINTAPI

        GetCursorPos p

        ScreenToClient hWnd, p

        SetWindowTextA hWnd, "lbtn" & "..." & p.x & "." & p.Y

Case WM_DESTROY,WM_NCDESTROY

      SetWindowLongptr hWnd,(-4),HookBox

End Select

BoxProc=CallWindowProc(HookBox,hWnd,Umsg,wParam,lParam)

End Function