Const SWP_FRAMECHANGED=&H20
Applies new frame styles set using the SetWindowLong function. Sends a WM_NCCALCSIZE message to the window, even if the window's size is not being changed. If this flag is not specified, WM_NCCALCSIZE is sent only when the window's size is being changed.
اعمال سبک یا استایل های قاب و چهارچوب جدید که با استفاده از تابع SetWindowLong تنظیم میشود .ارسال پیام WM_NCCALCSIZE به پنجره حتی اگر سایز پنجره تغییر نکند. اگر این flag مشخص نشود WM_NCCALCSIZE فقط زمانی ارسال می شود که سایز پنجره تغییر داده شود.
پس زمانیکه بخواهید از پیام WM_NCCALCSIZE برای محاسبه طول و عرض یا مختصات پنجره ای استفاده کنید در صورتیکه پنجره سایزش تغییر نمی کند از تابع SetWindowLong و استایل SWP_FRAMECHANGED استفاده می کنید که هگزار دسیمال آن 20 است و دسیمال برابر 14 ( 20 تقسیم بر 16 خارج تقسیم و مانده کنار هم قرار می گیرند اگر مانده بیشتر و خود 10 شد به ترتیب A تا F جایگزین مانده میشود )
Type RECT
Left As Long
Right As Long
Top As Long
Bottom As Long
End Type
Type WINDOWPOS
hwnd As Long 'LongPtr ( 64 bit )
hWndInsertAfter As Long 'LongPtr ( 64 bit )
x As Long ' Left
y As Long ' Top
cx As Long ' Width in pixle
cy As Long ' Height in pixle
flags As Long
End Type
Type NCCALCSIZE_PARAMS
rgrc(3) As RECT
lppos As WINDOWPOS
END TYPE
the first rectangle contains the new coordinates of a window that has been moved or resized, that is, it is the proposed new window coordinates. The second contains the coordinates of the window before it was moved or resized. The third contains the coordinates of the window's client area before the window was moved or resized
در آرایه rgrc : ( حاوی اطلاعات زیر است )
اولین مستطیل حاوی مختصات پنجره جدید است که تغییر سایز یا جابجا شده ( Move ) ... مختصات جدید است
دومین مختصات پنجره قبل از تغییر سایز یا جابجایی است.
سومین حاوی مختصات پنجره ناحیه Client قبل از تغییر سایز یا جابجا شدن است.
در پیام WM_NCCALCSIZE اگر wParam فالز باشد lParam به ساختار RECT اشاره می کند و اگر True باشد به ساختار NCCALCSIZE_PARAMS.
Dim ncc AS NCCALCSIZE_PARAMS
Debug.Print wParam
CopyMemory ncc,lParam,ByVal Len(ncc)
Debug.Print ncc.rgrc(1).Right
CopyMemory lParam,ncc,ByVal Len(ncc)
پیام WM_SETFOCUS :
پس از اینکه فوکوس صفحه کلید را به دست آورد ، این پیام به پنجره ارسال میشود و wParam حاوی هندلی به پنجره ای است که فوکوس کیبورد را از دست داده ( با Tab یا ماوس به کنترل دیگری می روید ) و lParam هم صفر است .
می توانید در این پیام با تابع SetFocus ، فوکِس یا فوکوس را به کنترل مورد نظر برده تا WM_NCCALCSIZE ارسال شود و بتوانید مختصات پنجره مورد نظر را بگیرید.
SWP_FRAMECHANGED &H20
Applies new frame styles set using the SetWindowLongfunction. Sends a WM_NCCALCSIZE message to the window, even if the window's size is not being changed. If this flag is not specified, WM_NCCALCSIZEis sent only when the window's size is being changed
If you have changed certain window data using SetWindowLong, you must call SetWindowPos for the changes to take effect. Use the following combination for uFlags: SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED
.
(GWL_USERDATA (-21
Sets the user data associated with the window. This data is intended for use by the application that created the window. Its value is initially zero.
(SetWindowLong(hWnd,GWL_USERDATA,Value
Type RECT
left As Long
right As Long
top As Long
bottom As Long
End Typd
Type NCCALCSIZE_PARAMS
rgrc(3) As RECT
lppos As WINDOWPOS
End Type
Type WINDOWPOS
x As Long
y As Long
cx As Long ' width
cy As Long ' heigth
End Type
اولین مستطیل یا Rectangle حاوی مختصات جدید پنجره که جابجا یا تغییر سایز شده است طبق داکیومنت زیر
When the window procedure receives
the WM_NCCALCSIZE message, the first rectangle contains the new coordinates of a window that has been moved or resized, that is, it is the proposed new window coordinates. The second contains the coordinates of the window before it was moved or resized. The third contains the coordinates of the window's client area before the window was moved or resized
افزایش عرض یا طول مستطیل ( Rectangle )
InflateRect lprc,dx,dy
یک مستطیل را به منطقه به روز رسانی پنجره مشخص اضافه می کند
InvalidateRect hWnd,lpRect,bErase
Also Read offsetrect
WM_NCCALCSIZE return flags Global Const WVR_ALIGNTOP = &H0010 Global Const WVR_ALIGNLEFT = &H0020 Global Const WVR_ALIGNBOTTOM = &H0040 Global Const WVR_ALIGNRIGHT = &H0080 Global Const WVR_HREDRAW = &H0100 Global Const WVR_VREDRAW = &H0200 Global Const WVR_REDRAW = (WVR_HREDRAW Or WVR_VREDRAW) Global Const WVR_VALIDRECTS = &H0400 WM_NCCALCSIZE parameter structure' Type NCCALCSIZE_PARAMS rgrc As Long lppos As Long End Type Global Const MA_NOACTIVATEANDEAT = 4