VBA, MS Access MS Access в примерах

hWnd контрола в форме MS Access (API)

'--------------------------------------------------------------------------
' Module    : modGetControlWnd_API
' Purpose   : Получение hWnd контрола в форме
'--------------------------------------------------------------------------
Option Compare Database
Option Explicit

Private Declare Function GetFocusAPI Lib "user32" Alias "GetFocus" () As Long

Public Function GetControlWnd(ctrl As Control) As Long
'Возвращает дескриптор контрола (HWND) - Window Hundle
'--------------------------------------------------------------------------
On Error GoTo GetControlWnd_Err
    
    ctrl.SetFocus
    GetControlWnd = GetFocusAPI

GetControlWnd_Bye:
    Exit Function

GetControlWnd_Err:
    GetControlWnd = 0
    MsgBox "Ошибка " & Err.Number & vbCrLf & Err.Description & vbCrLf & "в процедуре: GetControlWnd", vbCritical, "Error in module modGetControlWnd_API"
    Resume GetControlWnd_Bye
End Function
Назад ToTop
L.E. 23.12.2017
Рейтинг@Mail.ru