在网页中,用鼠标将光标定位在某一文本框中,如何取得该文本框的对象名?另外,如果改变该文本框的背景色?
高手请指点!

解决方案 »

  1.   

    VERSION 5.00
    Begin VB.Form Form1 
       Caption         =   "Form1"
       ClientHeight    =   3195
       ClientLeft      =   60
       ClientTop       =   345
       ClientWidth     =   4680
       LinkTopic       =   "Form1"
       ScaleHeight     =   3195
       ScaleWidth      =   4680
       StartUpPosition =   3  '窗口缺省
       Begin VB.Timer Timer1 
          Interval        =   10
          Left            =   240
          Top             =   840
       End
       Begin VB.TextBox Text1 
          Height          =   495
          Left            =   600
          TabIndex        =   0
          Text            =   "Text1"
          Top             =   360
          Width           =   2655
       End
       Begin VB.Label Label2 
          Caption         =   "Label2"
          Height          =   375
          Left            =   1200
          TabIndex        =   2
          Top             =   2280
          Width           =   2055
       End
       Begin VB.Label Label1 
          Caption         =   "Label1"
          Height          =   375
          Left            =   960
          TabIndex        =   1
          Top             =   1560
          Width           =   2055
       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 Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
    Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) 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 Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As LongPrivate Type POINTAPI
            x As Long
            y As Long
    End Type
    Dim a As String * 100
    Private MousePos As POINTAPI
    Private Sub Timer1_Timer()
    GetCursorPos MousePos
    Label1 = WindowFromPoint(MousePos.x, MousePos.y)
    GetWindowText CLng(Label1), a, Len(a)
    Label2 = a
    '''''''''''''''''''''''''''''''''''
    ''''''''''''''''''''''''''''''''''''
    '''除非你知道你在做什么,否则请把他注掉
    'SetWindowText CLng(Label1),"Game Over"
    '''''''''''''''''''''''''''''''''''''
    ''''''''''''''''''''''''''''''''''''
    End Sub
      

  2.   

    什么是对象名?句柄么?
    这个可以找到句柄
    改变颜色不会,只会改变Text,应该是某个API 你自己也找一找
      

  3.   

    带输入框的网页每个input对像都有一个名字就是对象,如:<INPUT name="B2" TYPE="reset";我要找到的是网页中的对象名,不是窗口的文本框句柄。
      

  4.   

    只能分析Html了
    比如FrontPage DreamWeaver
    他们是通过分析Html实现的,并且还不是即时的(在编辑状态)
    对于你说的那种功能,我没有见过
    也许很难实现
    实现后给我写邮件 rzsonic#msn.com
    谢谢