تمام موارد کپی شده از داکیومنتِ موجود است تست شده همراه با تصویر ، ثابت ها نیز از داکیومنت استخراج و قابل مشاهده برای عموم است. لینک ها شما را به مطلب داکیومنت هدایت خواهند نمود.
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
GetClientRect()
to get the size of the client area.ClientToScreen()
to transform client rect to screen coordinates.GetWindowRect()
to get the rectangle of the control including NC area, in screen coordinates.leftBorderWidth = clientRect.left - windowRect.left
).how-to-set-the-size-of-the-non-client-area-of-a-win32-window-native
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 : در پی اهانت یک افسر هندی به سردار سلیمانی و رهبر انقلاب، مردم منطقه بدگام کشمیر به خیابانها ریختند و در حمایت از سردار سلیمانی شعار سردادند و با ماموران پلیس درگیر شدند و اقدام مامور هتاک را محکوم کردند. یکی از افسران هندی در حین عملیات سرشماری یکی از شهرهای کشمیر با ورود به منزل یکی از شهروندان عکس شهید سلیمانی و رهبرانقلاب را که در خانه او بود به آتش میکشد.
تمام این مطالب گردآوری شده از سایت های مختلف است بعضی امتحان شده و تصویر نیز در مطلب قرار داده شده و در بعضی موارد فقط مطلب Copy Paste شده است به بزرگی خودتان ببخشید دوستان
این تابع تعیین می کند آیا نقطه داخل ناحیه مشخص شده است یا خیر .فرضا یک ناحیه بیضوی درست کرده اید در WM_PAINT و می خواهید زمانیکه Mouse را داخل آن منطقه بردید کاری را برای شما انجام دهد ، lParam در WM_MOUSEMOVE قسمت loword آن xmouse و قسمت hiword آن ymouse است .
The PtInRegion function determines whether the specified point is inside the specified region.
For x = R.Left To R.Right
For y = R.Top To R.Bottom
'If the point is in the region, draw a green pixel
If PtInRegion(mRGN, x, y) <> 0 Then
'Draw a green pixel
setpixel ' Lib "gdi32"
SubClassing The Window : win64
Private OldWindowProc As LongPtr
Const WM_CONTEXTMENU=&H7b
Public Function NewWindowProc(ByVal hwnd As LongPtr, ByVal msg As Long, ByVal wParam As LongPtr, ByVal lParam As LongPtr) As LongPtr
Const WM_NCDESTROY = &H82
Debug print Hex$(msg)
If msg = WM_NCDESTROY Then
SetWindowLonPtr hwnd,GWL_WNDPROC,OldWindowProc End If
NewWindowProc=CallWindowProc(OldWindowProc,hwnd,msg,wParam,lParam)
.
کدام درست و منطقی تر است ؟
کار سختی نیست از منبعی که در انتهای صفحه آمده استفاده شده که تابع ویندوزی است
Declare PtrSafe Function PtInRect Lib "user32" (lpRect As RECT, pt As POINTAPI) As Long'
Use Belows Only
Declare PtrSafe Function PtInRect Lib "user32" (lpRect As RECT, ByVal x As Long, ByVal y As Long) As Long
If PtInRect(nn, p.x, p.y) Then
" ... MsgBox "You Clicked Me
End If
.....RedrawWindow
مورد بالا تست شده
در 32 بیت
getdlgctrlid : Retrieves the identifier of the
.specified control
بر گرفته از فروم خارجی ( بررسی موقعیت ماوس در باتن موردنظر )
1-find your button rectangle
GetWindowRect BtnHwnd,BtnRect
WM_SETCURSOR
. Do not change anything, just detect if wParam is HWND of your button. If it is, then set a #define WM_SETCURSOR 0x0020