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

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

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

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

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

ScrollBar



At the picture below you can see what I've already done. Left scrollbar is a system scrollbar, right one - custom scrollbar.




FVertBar: Boolean; FPressedBtn1, FPressedBtn2, FSelectedBtn1, FSelectedBtn2: Boolean; FBarBmp, FBtn1Bmp, FBtn2Bmp: TBitmap; MainDC: hDC; 


FBarBmp.Free; FBtn1Bmp.Free; FBtn2Bmp.Free;


Case WM_ENABLE ' WM_SHOWWINDOW
Width=100
Height=80

FSelectedBtn1=false
FSelectedBtn2=false
FPressedBtn1=false
FPressedBtn2=false

(FBarBmp=LoadImageA(0,"D:\...bmp",0,16,16,&H10
=FBtn1Bmp
=FBtn2Bmp

Case WM_DESTROY

DeleteObject FBarBmp
DeleteObject FBtn1Bmp
DeleteObject FBtn2Bmp


Case WM_NCCALCIZE

decrease width to create non-client area'
(Dec(Message.CalcSize_Params.rgrc(0).Right,17
FVertBar= true


Case WM_NCPAINT

(MainDC=GetWindowDC(Hwnd

(if FVertBar then PaintScrollBarVert(MainDC

if FVertBar then 
PaintButtonVert1 MainDC
PaintButtonVert2 MainDC
End if 
Enf if 
ReleaseDC Handle, MainDC


Case WM_NCMOUSEMOVE

GetCursorPos pt
ScreenToClient hwnd,pt

Top Vert Button'
(Rect(Width - 17 - 2, ClientRect.Top, Width - 2, 17
if PtInRect(Crect,pt) then
FSelectedBtn1= true
else
FSelectedBtn1=false
End If 
bottom vert button '
Rect(Width - 17 - 2, ClientRect.Bottom - 17, Width - 2,
(ClientRect.Bottom + 17,
if PtInRect(Crect,pt)   then
FSelectedBtn2=true
else
FSelectedBtn2=false
End if 
SendMessageA hwnd,WM_NCPAINT,1, 0



Cas WM_NCLBUTTONDOWN

GetCursorPos pt 
ScreenToClient hwnd,pt
'Top Vert Button
Rect(Width - 17 - 2, ClientRect.Top, Width - 2, 17)
if PtInRect(Crect,pt) then
FPressedBtn1=true
End If 
'bottom vert button 
Rect(Width - 17 - 2, ClientRect.Bottom - 17, Width - 2, ClientRect.Bottom + 17)
if PtInRect(Crect,pt)   then
FPressedBtn2=true
End if 
SendMessageA hwnd,WM_NCPAINT,1, 0


Case WM_NCLBUTTONUP
FPressedBtn1=false
FPressedBtn2 =false 
SendMessageA hwnd,WM_NCPAINT,1, 0


(PaintScrollBarVert(hDC

FBarBmp.Width= 17
FBarBmp.Height=ClientRect.Bottom
FBarBmp.Canvas.Brush.Color=clLime FBarBmp.Canvas.FillRect(FBarBmp.Canvas.ClipRect)
BitBlt(MainDC,Width-17-2,ClientRect.Top + 2,FBarBmp.Width,FBarBmp.Height, FBarBmp.Canvas.Handle,0, 0,SRCCOPY) 


(PaintButtonVert1(hDC


FBtn1Bmp.Width=17
FBtn1Bmp.Height=17

if not FSelectedBtn1 then FBtn1Bmp.Canvas.Brush.Color=clRed
End if 

if FSelectedBtn1 then FBtn1Bmp.Canvas.Brush.Color =clBlue
End if 

if FSelectedBtn1 and FPressedBtn1 then FBtn1Bmp.Canvas.Brush.Color=clPurple
FBtn1Bmp.Canvas.FillRect(FBtn1Bmp.Canvas.ClipRect)
BitBlt(DC, Width - 17 - 2, ClientRect.Top + 2, FBtn1Bmp.Width, FBtn1Bmp.Height, FBtn1Bmp.Canvas.Handle, 0, 0, SRCCOPY)
End if 



(PaintButtonVert2(hDC


FBtn2Bmp.Width=17
FBtn2Bmp.Height=17

if not FSelectedBtn2 then FBtn1Bmp.Canvas.Brush.Color=clRed
End if 

if FSelectedBtn2 then FBtn1Bmp.Canvas.Brush.Color=clBlue
End if 

if FSelectedBtn2 and FPressedBtn2 then FBtn1Bmp.Canvas.Brush.Color=clPurple
FBtn1Bmp.Canvas.FillRect(FBtn1Bmp.Canvas.ClipRect)
BitBlt(DC, Width - 17 - 2, ClientRect.Bottom - 17 + 2, FBtn1Bmp.Width,FBtn1Bmp.Height, FBtn1Bmp.Canvas.Handle, 0, 0, SRCCOPY)
End if 





مربوط به مثال بالا نیست 






GWL_USERDATA



When you send a WM_CLOSE message to a window, it tries to close the window as if the X button were pressed.You cannot know whether the application was closed externally or by clicking the X button

But there is an easy alternative. When you are closing the window externally using WM_CLOSE, you can initialize its 32-bit user data value using the SetWindowLong function before sending the message. In the target application (being closed) you will query this user data using GetWindowLong function and execute your code accordingly.

The user data value is set to 0 by default. You can set it to any non-zero value before sending the WM_CLOSE 
.message


Set the user data value of the target window to -1'
(originally 0)'
WIN32'
SetWindowLong CurrApp,GWL_USERDATA,-1

send closing messgae'
CurrApp is a Handle to the window
&SendMessage CurrApp,WM_CLOSE, 0,ByVal 0

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    If GetWindowLong(hwnd, GWL_USERDATA) = 0 Then
        MsgBox "Closing from X."
    Else '(if -1)
        MsgBox "Closing externally using WM_CLOSE."
    End If
End Sub