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

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

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

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

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

تعدادی از توابع ویندوزی در VBA7




Private Declare PtrSafe Function GetWindowRect Lib "user32" (ByVal hwnd As LongPtr, lpRect As RECT) As Long

Private Declare PtrSafe Function SetWindowPos Lib "user32" (ByVal hwnd As LongPtr, ByVal hWndInsertAfter As LongPtr, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long

Private Declare PtrSafe Function SetParent Lib "user32" (ByVal hWndChild As LongPtr, ByVal hWndNewParent As LongPtr) As LongPtr

Private Declare PtrSafe Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As LongPtr, ByVal hWnd2 As LongPtr, ByVal lpsz1 As String, ByVal lpsz2 As String) As LongPtr

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

Private Declare PtrSafe Function ReleaseCapture Lib "user32" () As Long

Private Declare PtrSafe Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As LongPtr, ByVal wMsg As Long, ByVal wParam As LongPtr, lParam As Any) As LongPtr 


'Some Constants 


Private Const WS_EX_MDICHILD = &H40
Private Const GWL_EXSTYLE = (-20)
Private Const SWP_NOSIZE = &H1
Private Const SWP_SHOWWINDOW = &H40
Private Const HTCAPTION = 2
Private Const WM_NCLBUTTONDOWN = &HA1


xlDesk

Excel7

Form_Activate

OHwnd = FindWindowEx(Application.hwnd, 0, "OMain", vbNullString)
GetWindowRect hWndForm, tRect
tPt.X = tRect.Left
tPt.Y = tRect.Top
SetParent hWndForm, OHwnd
ScreenToClient OHwnd, tPt
SetWindowLong(hWndForm, GWL_EXSTYLE, GetWindowLong(WbHwnd, GWL_EXSTYLE) Or WS_EX_MDICHILD)
SetWindowPos(hWndForm, 0, tPt.X, tPt.Y, 0, 0, SWP_SHOWWINDOW Or SWP_NOSIZE)


Form_MOUSEMOVE 

If Button = 1 Then
ReleaseCapture
SendMessage hWndForm, WM_NCLBUTTONDOWN, HTCAPTION, 0&
End If



CB_SETDROPPEDWIDTH=&H160
hWndXl = ApphWnd ---> ("XLMAIN")
hWndFormulaBar = FindWindowEx(hWndXl, 0, _
          "EXCEL;", vbNullString)
hWndNameCombo = FindWindowEx(hWndFormulaBar, 0, _
         "combobox", vbNullString)
https://docs.microsoft.com/en-us/windows/win32/controls/cb-getdroppedwidth
'CB_GETDROPPEDWIDTH message
'Parameters
'wParam : Not used; must be zero.
'lParam   : Not used; must be zero.
'Return value :
'If the message succeeds, the return value is the width, in pixels. 'drop down width SendMessage hWndNameCombo,CB_SETDROPPEDWIDTH, 200, 0



CB_SETEDITSEL message  :


Parameters

wParam :This parameter is not used

lParam [in]

The LOWORD of lParam specifies the starting position. If the LOWORD is -1, the selection, if any, is removed.

The HIWORD of lParam specifies the ending position. If the HIWORD is -1, all text from the starting position to the last character in the edit control is selected.

Return value : در صورت موفقیت عدد غیر صفر بر می گرداند

If the message succeeds, the return value is TRUE. If the message is sent to a combo box with the CBS_DROPDOWNLIST style, it is CB_ERR.

Remarks : موقعیت  اولین کارکتر در کنترل ویرایش  صفراست

The positions are zero-based. The first character of the edit control is in the zero position. The first character after the last selected character is in the ending position. For example, to select the first four characters of the edit control, use a starting position of 0 and an ending position of 4

 










نظرات 0 + ارسال نظر
برای نمایش آواتار خود در این وبلاگ در سایت Gravatar.com ثبت نام کنید. (راهنما)
ایمیل شما بعد از ثبت نمایش داده نخواهد شد