А при помощи Апи не пойдёт?: ' в модуле Private Declare Function CreateWindowExA Lib "user32" (ByVal dwExStyle As Long, ByVal lpClassName As String, ByVal lpWindowName As String, ByVal dwStyle As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As Long, ByVal hMenu As Long, ByVal hInstance As Long, lpParam As Any) As Long Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long Private Declare Function CallWindowProcA Lib "user32" (ByVal lpPrevWndFunc As Long, ByVal lngHandle As Long, ByVal lngMsg As Long, ByVal lngFirstParam As Long, ByVal lngLastParam As Long) As Long Private Declare Function SetWindowLongA Lib "user32" (ByVal lngHandle As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private lngOldProc As Long Public Sub CreateButton(ByVal lngParent As Long, ByVal strCaption As String, ByVal lngTop As Long, ByVal lngLeft As Long, ByVal lngHeight As Long, ByVal lngWidth As Long) Dim lngHandle As Long lngHandle = CreateWindowExA(0, "button", strCaption, &H40000000, lngLeft, lngTop, lngWidth, lngHeight, lngParent, 0, App.hInstance, ByVal 0) ShowWindow lngHandle, 1 SetProc lngHandle End Sub Public Sub SetProc(ByVal lngHandle As Long) lngOldProc = SetWindowLongA(lngHandle, -4, AddressOf WinProc) End Sub Private Function WinProc(ByVal lngHandle As Long, ByVal lngMsg As Long, ByVal lngFirstParam As Long, ByVal lngLastParam As Long) As Long If lngMsg = &H202 Then MsgBox "Mouse_Up на кнопке" WinProc = CallWindowProcA(lngOldProc, lngHandle, lngMsg, lngFirstParam, lngLastParam) End Function ' в форме Private Sub Form_Load() CreateButton hwnd, "Кнопка", 10, 10, 30, 100 End Sub Или те что-то другое нада?
Ответить
|