کلینیک فوق تخصصی اکسس ( کاربرد 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 : در پی اهانت یک افسر هندی به سردار سلیمانی و رهبر انقلاب،  مردم منطقه بدگام کشمیر به خیابان‌ها ریختند و در حمایت از سردار سلیمانی شعار سردادند و با ماموران پلیس درگیر شدند و اقدام مامور هتاک را محکوم کردند. یکی از افسران هندی در حین عملیات سرشماری یکی از شهرهای کشمیر با ورود به منزل یکی از شهروندان عکس شهید سلیمانی و رهبرانقلاب را که در خانه او بود به آتش می‌کشد. 








PAINT-BUTTON

احتملا Rec   در پیام WMPAINT باید Global یا Static تعیین شود.  تست نشده ولی روال بدین شکل است .


Private Pressed As Boolean
Private FocusLost As Boolean
Private TRect As RECT



Border3D_Y, Border_Thickness, Btn_Width,Button_Width, Button_Height


(GetWindowDC(FrmMainForm.Handle
(Border3D_Y=GetSystemMetrics(SM_CYEDGE

(Border_Thickness=GetSystemMetrics(SM_CYSIZEFRAME

(Button_Width=GetSystemMetrics(SM_CXSIZE

(Button_Height=GetSystemMetrics(SM_CYSIZE

Btn_Width=Border3D_Y+Border_Thickness+Button_Height-(2 * Border3D_Y) - 1

*Rec.Left=FrmMainForm.Width-(3 
(Button_Width+Btn_Width

+Rec.Right=FrmMainForm.Width - (3 * Button_Width 
(03

Rec.Top=Border3D_Y+Border_Thickness -1

*Rec.Bottom=Rec.Top+Button_Height - (2 
(Border3D_Y

FillRect 
(MyCanvas.Handle,Rec,HBRUSH(COLOR_BTNFACE+1

If not Pressed or Focuslost Then
    DrawEdge MyCanvas.Handle, Rec, EDGE_RAISED,BF_SOFT or BF_RECT
  Else If Pressed and Not Focuslost Then
    DrawEdge MyCanvas.Handle, Rec, EDGE_SUNKEN, BF_SOFT or BF_RECT

DrawIconEX MyCanvas.Handle,Rec.Left+4,Rec.Top+3,Application.Icon.Handle,8, 8, 0, 0, DI_NORMAL



WMNCACTIVATE
(InvalidateRect FrmMainForm.Handle, Rec, True
 

WMNCPAINT
InvalidateRect FrmMainForm.Handle, Rec, True


WMNCMOUSEDOWN

PT1.X=Loword(LParam)- FrmMainForm.Left
PT1.Y=Hiword(LParam)- FrmMainForm.Top
 
  if PTInRect(Rec,PT1.x,PT1.y) Then
      Pressed=True
      FocusLost=False
   InvalidateRect FrmMainForm.Handle, Rec,True
 SetCapture TWinControl(FrmMainForm).Handle
End If


WMLBUTTONUP

  Tmp  Boolean
 
 ReleaseCapture
  Tmp=Pressed
  Pressed=False
  if Tmp and PTInRect(Rec, PT1.x,PT1.y) Then
 
    InvalidateRect FrmMainForm.Handle, Rec,True
   
WMNCHITTEST

  Tmp : Boolean

  if Pressed then
      Tmp=FocusLost
 End if
   
PT1.X=Loword(LParam)- FrmMainForm.Left
PT1.Y=Hiword(LParam)- FrmMainForm.Top
   
   if PTInRect(Rec, PT1.x,PT1.y) then
      FocusLost=False
   else
      FocusLost=True
  End if

    if FocusLost =Tmp then
      InvalidateRect FrmMainForm.Handle, Rec,True
  End If 


SM_CXSCREEN = 0
SM_CYSCREEN = 1

SM_CXSIZE = 30
SM_CYSIZE = 31

SM_CXFRAME = 32
SM_CYFRAME = 33

SM_CYCAPTION = 4

SM_CXBORDER = 5
SM_CYBORDER = 6

SM_CXICON = 11
SM_CYICON = 12

SM_CYSIZEFRAME =    SM_CYFRAME
            SM_CXSIZEFRAME =    SM_CXFRAME

SM_CXFRAME = 32
SM_CYFRAME = 33

SM_CXEDGE = 45
SM_CYEDGE = 46