⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.frm

📁 通过程序向另一软件发送信息或截取另一软件界面上的信息vb源码
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   7845
   ClientLeft      =   60
   ClientTop       =   375
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   7845
   ScaleWidth      =   4680
   StartUpPosition =   3  '窗口缺省
   Begin VB.TextBox Text1 
      Appearance      =   0  'Flat
      Height          =   5955
      Left            =   180
      MultiLine       =   -1  'True
      ScrollBars      =   3  'Both
      TabIndex        =   1
      Text            =   "Form1.frx":0000
      Top             =   1740
      Width           =   4125
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Command1"
      Height          =   675
      Left            =   930
      TabIndex        =   0
      Top             =   810
      Width           =   1725
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub Command1_Click()

    Dim ObjN As IHTMLDocument2
    
    Dim HtmlForms As IHTMLElementCollection
    Dim HtmlForm As IHTMLFormElement
    Dim FormName As String ': WideString;
    Dim Name, Index
    Dim InputElement As IHTMLInputElement
    Dim I, J, K As Integer
    Dim Itemindex, ItemName
    Dim InputName, InputValue As String
    Set ObjN = IEDOMFromhWnd(66300)



    Set HtmlForms = ObjN.Forms
    If HtmlForms.length = 0 Then Exit Sub
    On Error Resume Next
    For K = 0 To HtmlForms.length - 1
        Set HtmlForm = HtmlForms.Item(K, K)
    
    
        J = HtmlForm.length - 1
    
        For I = 0 To J - 1
            Name = HtmlForm.Item(I, 0).Name
            Debug.Print Name
            If Name = "" Then GoTo lm
            HtmlForm.Item("" & Name & "").Value = "" & Name & "" + "DFDF"
lm:
        Next
    Next
    
    HtmlForm.Item("username").Value = "DFDF"
    'ObjN.All.Item("username").Value = "DFDF"
    
    
    
    
    For I = 0 To HtmlForm.length - 1
        Itemindex = 0
        ItemName = I
        Name = HtmlForm.Item(ItemName, Itemindex)

           If (InputElement.Type = "text") Or (InputElement.Type = "password") Then
               InputName = InputElement.Name
               InputValue = InputElement.Value
           End If
        
    Next

    Text1.Text = ObjN.activeElement
    Text1.Text = ObjN.Forms("" & Text1.Text & "", 1)








'Dim Rg As IHTMLTxtRange
'Dim CtlRg As IHTMLControlRange
'
'' branch on the type of selection and
'' get the element under the caret or the site selected object
'' print its outerHTML
'
'Select Case ObjName.selection.Type
'Case "None", "Text"
'
'Set Rg = ObjName.selection.createRange
'
'' collapse the range so that the scope of the
'' range of the selection is the caret. That way the
'' parentElement method will return the element directly
'' under the caret. If you don't want to change the state of the
'' selection, then duplicate the range and collapse it
'
'Rg.collapse
'MsgBox Rg.parentElement.outerHTML
'
'Case "Control"
'' an element is site selected
'
'Set CtlRg = ObjName.selection.createRange
'
'' there can only be one site selected element at a time so the
'' commonParentElement will return the site selected element
'
'MsgBox CtlRg.commonParentElement.outerHTML
'
'End Select


'Text1.Text = ObjName.body.innerText

End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -