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

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

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

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

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

Right Click

Shift+F10


SendKeys("+{F10}") 'for a right click

Mouse Hook

در سیستم 64 بیت



Public Function LowLevelMouseProc(ByVal nCode As Long, ByVal wParam As LongPtr, ByVal lParam As LongPtr) As LongPtr

If nCode > 0 Then

    Select Case wParam

         Case WM_NCDESTROY, WM_DESTROY

             UnhookWindowsHookEx hhk

         Case WM_RBUTTONDOWN, WM_RBUTTONUP

           LowLevelMouseProc = 1

        Exit Function

         Case Else

          ( LowLevelMouseProc = CallNextHookEx(hhk, nCode, wParam, lParam

     End Select

 End If

CallNextHookEx hhk, nCode, wParam, lParam

End Function





FIFA 2020




ما  اعلام می کنیم که نامه های تاریخ 9 و 16 جولای را دریافت کرده و تایید می کنیم که موضوع بحث شده را متوجه شدیم.
با این وجود، باید مطلع شوید که براساس تصمیم مجمع فیفا در 16 مارس 2018، بازی های رسمی فیفا نمی توند در عراق برگزار شود مگر اینکه ارزیابی میزان مخاطرات توسط فیفا به طور موقت اجازه این کار را بدهد. اما این امکان در حال حاضر وجود ندارد. ریسک های امنیتی هنوز خیلی بالاست و اخیرا بیش  از اینکه بهتر شود، وخیم تر شده است.

بازی های مقدماتی جام جهانی 2022 نیز طبق قوانین و اساسنامه های فیفا باید برگزار شود بنابراین عراق باید برای بازی های خانگی خود در مقدماتی جام جهانی 2022  ورزشگاهی خارج از خاک خود را معرفی کند. لطفا فیفا و ای اف سی را از تصمیم خود تا قبل از یکم آگوست مطلع سازید.

پیام اعلام راست کلیک توسط User به پنجره Right Clicked








Public Function MouseHookProc(ByVal nCode As Long,ByVal wParam As LongPtr,ByVal lParam As LongPtr) As LongPtr

      Dim MyMouseHookStruct As New
 ()MOUSEHOOKSTRUCT

Dim ret As Integer = 0

If (nCode < 0) Then
,Return CallNextHookEx(hHook, nCode, wParam
 (lParam

End If
If wParam = WM_RBUTTONDOWN Or wParam = WM_RBUTTONUP Then
Return -1
End If
,Return CallNextHookEx(hHook, nCode, wParam
 (lParam
End Function


Hook ؛ کنترل یا رهگیری Mouse Action




Responding To Mouse Click mouse-click




hook  is a mechanism by which an application can intercept events, such as

 messages, mouse actions, and keystrokes



(HHOOK SetWindowsHookExA( int idHook, HOOKPROC lpfn, HINSTANCE hmod, DWORD dwThreadId 

WH_MOUSE_LL=14


CALLBACK LowLevelMouseProc( _In_ int    nCode, _In_ WPARAM wParam, _In_ LPARAM lParam

HC_ACTION=0


wParam [in]
Type: WPARAM

The identifier of the mouse message. This parameter can be one of the following messages: WM_LBUTTONDOWN, WM_LBUTTONUP, WM_MOUSEMOVE, WM_MOUSEWHEEL, WM_MOUSEHWHEEL, WM_RBUTTONDOWN, or WM_RBUTTONUP.

If nCode is less than zero, the hook procedure must return the value returned by CallNextHookEx.

(CallNextHookEx( HHOOK hhk, int nCode, WPARAM wParam, LPARAM lParam

باتن چپ ماوس در محیط NonClient پنجره




lparam موقعیتی درستی از کرسر نمیدهد پس رو ش حساب باز نکنیدچرا ؟ چون داکیومنتش داره میگه








    windows-data-type


WORD  :  A 16-bit unsigned integer. The range is 0 through 65535 decimal.
WPARAM : message parameter.
LPARAM : message parameter.
HWND : A handle to a window.


لود کردن آیکون ، کرسر یا بیتمپ



LoadImageA   loadimagea


نحوه ی اظهار یا فراخوانی در سیستم 64 بیتی : 


Declare PtrSafe Function LoadImageA Lib "user32 (ByVal hInst As LongPtr, ByVal lpsz As String, ByVal ImgType As Long, ByVal cx  As Long, ByVal cy As Long, ByVal ufLoad As Long) As LongPtr


(hIcon=LoadImageA(0,"D:\ico1.ico",IMAGE_ICON,16,16,LR_LOADFROMFOLE



: (LR_LOADFROMFILE(&H10

Loads the stand-alone image from the file specifiedLby lpszName(icon,cursor, or bitmap file










نمایش آیکون در حالت  بزرگ  زمانیکه ALT+TAB 

را می فشارید و در مد کوچک در عنوان یا کپشن پنجره و ارسال با تابع ویندوزی SendMessageA که Msg همان WM_SETICON میشود wParam که در تصویر پائین ذکر شده  ICON_BIG یا ICON_SMALL  و  lParam هم  همان hIcon ذکر شده در بالا 


Declare PtrSafe Function SendMessageA Lib "User32" (ByVal hwnd As LongPtr,ByVal uMsg As Long,ByVal wParam As LongPtr,ByVal lParam As LongPtr) As LongPtr






مشخص کردن حالت نمایش پنجره


ShowWindow   showwindow


نحوه ی اظهار یا فراخوانی در ویندور 64 بیت  : 


Declare PtrSafe Function ShowWindow Lib "user32" (ByVal lhwnd As LongPtr, ByVal nCmdShow As Long) As Long







غیرفعال کردن SysMenu




#Get System menu of windows handled
(hMenu=GetSystemMenu(hwnd, 0
 
#Window Style : TOOLWINDOW
SetWindowLongPtrA(hwnd, GWL_EXSTYLE 
WS_EX_TOOLWINDOW) | Out-Null,

#Disable X Button and window itself
Enablemenuitem(hMenu, SC_CLOSE, MF_DISABLED)| Out-Nul
EnableWindow(hwnd, 0) | Out-Nul

ثابت های استایل پنجره برای تغییر یا ساخت



window-styles


استفاده در SetWindowLongPtrA در 64 بیت یا SetWindowLongA در 32 بیت 


'\ Window Style
Public Enum enWindowStyles
    WS_BORDER = &H800000
    WS_CAPTION = &HC00000
    WS_CHILD = &H40000000
    WS_CLIPCHILDREN = &H2000000
    WS_CLIPSIBLINGS = &H4000000
    WS_DISABLED = &H8000000
    WS_DLGFRAME = &H400000
    WS_EX_ACCEPTFILES = &H10&
    WS_EX_DLGMODALFRAME = &H1&
    WS_EX_NOPARENTNOTIFY = &H4&
    WS_EX_TOPMOST = &H8&
    WS_EX_TRANSPARENT = &H20&
    WS_EX_TOOLWINDOW = &H80&
    WS_GROUP = &H20000
    WS_HSCROLL = &H100000
    WS_MAXIMIZE = &H1000000
    WS_MAXIMIZEBOX = &H10000
    WS_MINIMIZE = &H20000000
    WS_MINIMIZEBOX = &H20000
    WS_OVERLAPPED = &H0&
    WS_POPUP = &H80000000
    WS_SYSMENU = &H80000
    WS_TABSTOP = &H10000
    WS_THICKFRAME = &H40000
    WS_VISIBLE = &H10000000
    WS_VSCROLL = &H200000

فرآیند پیام ارسال شده به پنجره WindowProc

Subclassing Controls



Declare PtrSafe Function CallWindowProcA Lib "user32" (ByVal lpPrevWndFunc As LongPtr, ByVal hwnd As LongPtr, ByVal Msg As Long, ByVal wParam As LongPtr, ByVal lParam As LongPtr) As Long

Declare PtrSafe Function SetWindowLongPtrA Lib "user32" (ByVal hwnd As LongPtr, ByVal nIndex As Long,ByVal dwNewLong As LongPtr) As Long

(Public Const GWL_WNDPROC = (-4

Global oldwndproc As LongPtr
Global wndHW As LongPtr




: Form_Load

wndHw=Me.Hwnd

(oldwndproc = SetWindowLongPtrA(Me.hwnd, GWL_WNDPROC, AddressOf WndProc


Form_Unload

SetWindowLongPtrA wndHw, GWL_WNDPROC, oldwndproc



Public Function WndProc(ByVal lhwnd As LongPtr, ByVal uMsg As Long, ByVal wParam As LongPtr, ByVal lParam As LongPtr) As Long

If uMsg = 516 Then 'WM_RBUTTONDOWNU           

        'Debug.Print "Intercepted WM_CONTEXTMENU at " & Now                        

       " MsgBox "Mouse Right Button Was Clicked                       

          WndProc=-1                      

ElseIf uMsg = WM_KEYDOWN Then        

           MsgBox wParam                    

             WndProc = True                    

     Else ' Send all other messages to the default message handler     

        (WndProc = CallWindowProcA(oldwndproc, lhwnd, uMsg, wParam, lParam

     End If

     

End Function



Public Const WM_KEYDOWN = &H100
Public Const WM_KEYUP = &H101
Public Const WM_CHAR = &H102
Public Const VK_RETURN = &HD
Public Const VK_UP = &H26
Public Const VK_DOWN = &H28
Public Const VK_HOME = &H24
Public Const VK_LEFT = &H25
Public Const VK_PRIOR = &H21
Public Const VK_LBUTTON = &H1  ' Left mouse button
Public Const VK_RBUTTON = &H2  ' Right mouse button
Public Const VK_MBUTTON = &H4  ' Middle mouse button (three-button mouse)

Public Const SC_SIZE = &HF000&
Public Const SC_MOVE = &HF010&
Public Const SC_MINIMIZE = &HF020&
Public Const SC_MAXIMIZE = &HF030&
Public Const SC_NEXTWINDOW = &HF040&
Public Const SC_PREVWINDOW = &HF050&
Public Const SC_CLOSE = &HF060&














Const WM_NCLBUTTONDOWN As Integer = 161
Const WM_SYSCOMMAND As Integer = 274
Const HTCAPTION As Integer = 2
Const SC_MOVE As Integer = 61456

If (Msg = WM_SYSCOMMAND) And (WParam = SC_MOVE) Then
Return
End If

If (Msg = WM_NCLBUTTONDOWN) And (WParam = HTCAPTION) Then
Return
If (Msg = WM_RBUTTONDOWN) And (WParam = WM_RBUTTONDOWN) Then
Return
End If


وقتی دابل کلیک روی قسمت تایتل بار انجام میشود یا بعبارتی  قسمت کپشن پنجره عمل ماکسیمایز پنجره انجام خواهد گرفت

If umsg = WM_NCLBUTTONDBLCLK And wParam = 2 Then Exit Function

SYsMenu عمل نکردن منوهای تایتل بار یا 

If umsg = WM_SYSCOMMAND And ((wParam = SC_CLOSE) Or (wParam = SC_MINIMIZE) Or (wParam = SC_MAXIMIZE)) Then
Exit Function

مثال دیگر :
    wm-ncdestroy   &H82
If Msg = WM_NCDESTROY Then 
SetWindowLong hWnd,GWL_WNDPROC,OldWindowProc
End If 
If Msg <> WM_CONTEXTMENU Then
NoPopupWindowProc = CallWindowProc(OldWindowProc,hWnd
,Msg,wParam,lParam)

----------------------------------------

 اگر از HOOK  استفاده شود و آیدی WH_MOUSE یا WH_MOUSE_LL


If Wparam=WM_NCLBUTTONDBLCLK Then 
     MouseHookProc=NoneZero
End If



WM_RBUTTONDOWN   wm-rbuttondown   &H204

(20×16)×1.6+4=516 ( DECIMAL )


516÷16=32  

516-(32×16)=4

(516÷16)×10=320

320÷16=20



List Of Windows Message  SendMessageList

SubClassing



SetWindowSubclass hwnd,SubClassProc&,1,0


 SubClassProc(Byval hwnd as Longptr,Byval uMsg As Long,Byval wParam as LongPtr,Byval lParam As LongPtr,Byval uId As Long,Byval dwRef as Long) As LongPtr


DefSubClassProc Hwnd,uMsg,wParam,lParam


RemoveWindowSubClass hwnd,SubClassProc&,1



GWL_WNDPROC=-4


lpfnOld=SetWindowLongA(hwnd,GWL_WNDPROC,Address

( Of WndProc






(Of WNDProc



   ( GetPropA hwnd,lPstring       (Retrieve A Data Handle 


SetPropA hwnd,lPstring,hData


RemovePropA hwnd,lPstring 



WndPro(Byval hwnd as LongPtr,Byval uMsg

 as Long,Byval wParam as LongPtr,Byval lParam as LongPtr) As LongPtr

Select Case uMsg

Case WM_NCDESTROY ' &H82

  Call UnSubClass( hwnd)   'Built-In Function

End Select

)WndProc=CallWindowProcA

((GetPropA(hwnd,OldWndProc),hwnd,uMsg,wParam,lParam





مسیج های ویندوزی



' { W
' WH_* constants used for SetWindowsHookEx {
'
public const WH_CBT = 5
public const WH_KEYBOARD_LL = 13 ' Low level keyboard events
public const WH_SHELL = 10 ' Notification of shell events, such as creation of top level windows.
' }
' { WM_*: Window messsages
public const WM_CHAR = &h0102
public const WM_DESTROY = &H0002
public const WM_CLOSE = &H0010
public const Wm_CREATE = &H0001
public const WM_PAINT = &H000F
public const WM_KEYDOWN = &h0100
public const WM_KEYUP = &h0101
public const WM_SYSKEYUP = &h0105
public const WM_SETTEXT = &h000C public const WM_SETTINGCHANGE = &H001A
public const WM_SYSKEYDOWN = &h0104
public const WM_SIZE = &h0005 ' } ' { WS_* / Window styles
public const WS_THICKFRAME = &H40000
public const WS_VISIBLE = &H10000000
public const WS_VSCROLL = &H200000
public const WS_MAXIMIZE = &H1000000
public const WS_TABSTOP = &H10000
public const WS_BORDER = &H800000
public const WS_MAXIMIZEBOX = &H10000
public const WS_MINIMIZE = &H20000000
public const WS_MINIMIZEBOX = &H20000
public const WS_DLGFRAME = &H400000
public const WS_SYSMENU = &H80000
public const WS_CLIPSIBLINGS = &H4000000
public const WS_CAPTION = WS_BORDER or WS_DLGFRAME
public const WS_CHILD = &H40000000
public const WS_CLIPCHILDREN = &H2000000
public const WS_CHILDWINDOW = WS_CHILD public const WS_DISABLED = &H8000000
public const WS_GROUP = &H20000
public const WS_EX_ACCEPTFILES = &H10&
public const WS_EX_DLGMODALFRAME = &H1&
public const WS_EX_STATICEDGE = &H20000
public const WS_EX_NOPARENTNOTIFY = &H4& public const WS_EX_TOPMOST = &H8&
public const WS_POPUP = &H80000000
public const WS_EX_TRANSPARENT = &H20& public const WS_HSCROLL = &H100000
public const WS_ICONIC = WS_MINIMIZE
public const WS_OVERLAPPED = &H0&
public const WS_OVERLAPPEDWINDOW = WS_OVERLAPPED or WS_CAPTION or WS_SYSMENU or WS_THICKFRAME or WS_MINIMIZEBOX or WS_MAXIMIZEBOX
public const WS_TILEDWINDOW = WS_OVERLAPPEDWINDOW
public const WS_POPUPWINDOW = WS_POPUP or WS_BORDER or WS_SYSMENU
public const WS_SIZEBOX = WS_THICKFRAME
public const WS_TILED = WS_OVERLAPPED

ارسال اسکی کد به پنجره ی کلاس Edit


VK_CONTROL=&H11
VK_RETURN=&HD        '  Enter       Key 
VK_PRIOR=&H21          '  PAGE UP Key
VK_NEXT=&H22           '  PAGE DOWN Key
قسمت بالا در WM_KeyDown کاربرد دارند 
H31                             '  1                     Key&



WM_KEYDOWN=&H100

WM_CHAR = &H102



asciiChar مثل &H32   ارسال عدد 32


(SendMessageA(hwndEdit, WM_CHAR, asciiChar, 0    



You can unhide the menu bar in Acrobat itself by pressing the “F9” key on Windows


AVPageView در Acrobat.Exe

 

if GetClassNameTxt(pHwnd)="AVL_AVView" And GetWindowText(pHwnd)="AVPageView" Then

((TEdit=GetWindowTxt(FindWindowEx(pHwnd,0,"RICHEDIT50W",VbNullString 

End If


تغییر کپشن نویگیشن فرم





که بجای  کلمه ی Record  لغت Item در کپشنش قرار خواهد گرفت 

رنگ خطوط بصورت یک در میان در گزارش Alternative Color



البته در نسخه های ۲۰۰۷ و بالاتر Alternative Color در پراپرتی شیت گزارش وجود دارد   در سکشن Page Header یا Detail و روش زیر لازم نیست 





Report Effect




    Table 14.1. Interaction of MoveLayoutNextRecord, and PrintSection. 
MoveLayout

NextRecord

PrintSection

Effect

True

True

True

Move to the next position, get the next record, and print the data.

True

False

True

Move to the next position, remain on the same record, and print the data.

True

True

False

Move to the next position, get the next record, and don't print the data. This has the effect of skipping a record and leaving a blank space.

True

False

False

Move to the next position, remain on the same record, and don't print. This causes a blank space to appear without moving to the next record.

False

True

True

Remain in the same position, get the next record, and print the data. This has the effect of overlaying one record on another.

False

False

True

Not allowed.

False

True

False

Remain in the same position, get the next record, and refrain from printing. This has the effect of skipping a record without leaving a blank space.

False

False

False

Not allowed.

FormatCount 

The FormatCount property is used to evaluate the number of times the Format event has occurred for the current section of the report. The Format event occurs more than once whenever the Retreat event occurs. By checking the FormatCount property, you can ensure that complex code placed within the Format event is executed only once. 

PrintCount 

The PrintCount property is used to identify the number of times the Print event has occurred for the current section of the report. The Print event occurs more than once whenever the Retreat event occurs. By checking the value of the PrintCount property, you can ensure that logic within the Print event is executed only once. 




Private Sub Report_Activate()
' Used by Solutions to show toolbar that includes Show Me button.
' Hide built-in Print Preview toolbar.
DoCmd.ShowToolbar "Print Preview", acToolbarNo
' Show Custom Print Preview toolbar.

DoCmd.ShowToolbar "Custom Print Preview", acToolbarYes

End Sub