Naghual
| Цитата | | Удивляют меня эти гости. |
я просто не заметил, что не залогинился... оффтоп: объясняю почему лень, потому, что у этого форума (насколько я понял) нельзя прикреплять файлы (я бы с удовольствием прикрепил архив файлов проекта) Поэтому выкладываю весь код в листинге:
| Код | VERSION 5.00 Object = "{683364A1-B37D-11D1-ADC5-006008A5848C}#1.0#0"; "dhtmled.ocx" Begin VB.Form Form1 Caption = "Form1" ClientHeight = 4635 ClientLeft = 60 ClientTop = 345 ClientWidth = 4470 LinkTopic = "Form1" ScaleHeight = 4635 ScaleWidth = 4470 StartUpPosition = 3 'Windows Default Begin VB.CommandButton Command2 Caption = "ПослатьСообщение" Height = 615 Left = 2400 TabIndex = 6 Top = 3120 Width = 1575 End Begin VB.TextBox Text3 Height = 285 Left = 120 TabIndex = 5 Top = 2520 Width = 2175 End Begin VB.TextBox Text2 Height = 285 Left = 120 TabIndex = 4 Top = 3480 Width = 2175 End Begin VB.Timer Timer1 Interval = 1000 Left = 3960 Top = 3960 End Begin VB.TextBox Text1 Height = 285 Left = 120 TabIndex = 3 Top = 3120 Width = 2175 End Begin VB.CommandButton Command1 Caption = "Send message to DHTMLEdit" Height = 255 Left = 120 TabIndex = 2 Top = 2040 Width = 2775 End Begin VB.PictureBox picContainer BorderStyle = 0 'None Height = 1935 Left = 120 ScaleHeight = 1935 ScaleWidth = 3495 TabIndex = 0 Top = 120 Width = 3495 Begin DHTMLEDLibCtl.DHTMLEdit DHTMLEdit1 Height = 1815 Left = 0 TabIndex = 1 Top = 0 Width = 3495 ActivateApplets = 0 'False ActivateActiveXControls= 0 'False ActivateDTCs = -1 'True ShowDetails = 0 'False ShowBorders = 0 'False Appearance = 1 Scrollbars = -1 'True ScrollbarAppearance= 1 SourceCodePreservation= -1 'True AbsoluteDropMode= 0 'False SnapToGrid = 0 'False SnapToGridX = 50 SnapToGridY = 50 BrowseMode = -1 'True UseDivOnCarriageReturn= 0 'False End End Begin VB.Label Label1 Caption = "WindowFromPoint" Height = 255 Left = 120 TabIndex = 7 Top = 2880 Width = 2295 End End Attribute VB_Name = "Form1" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Private Declare Function FindWindowExA Lib "user32" (ByVal hWndParent As Long, ByVal hWndChildAfter As Long, ByVal lpClassName As String, ByVal lpWindowName As String) As Long Option Explicit Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Const WM_CHAR = &H102 Private Const WM_KEYDOWN = &H100
Private Type POINTAPI x As Long y As Long End Type
Dim h As Long
Private Sub Command1_Click() SendMessage h, WM_KEYDOWN, 35, 0& End Sub
Private Sub Command2_Click() SendMessage CLng(Val(Text1.Text)), WM_KEYDOWN, 35, 0&
End Sub
Sub Form_Load() h = FindWindowExA(picContainer.hWnd, 0, vbNullString, vbNullString) DHTMLEdit1.LoadDocument "c:\boot.ini" Text3.Text = h End Sub
Private Sub Timer1_Timer() Dim pCur As POINTAPI Dim hWnd As Long Dim sText As String sText = String$(256, " ") GetCursorPos pCur hWnd = WindowFromPoint(pCur.x, pCur.y) Text1.Text = hWnd GetWindowText hWnd, sText, 255 Text2.Text = Trim$(sText) End Sub
|
этот примерчик показывает, что dhtml реагирует на посылку ему сообщения, а переменная h содержит не его хендл. |