how can i get the handle of a window's textbox
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: how can i get the handle of a window's textbox

  1. #1
    Join Date
    Apr 2005
    Posts
    8

    how can i get the handle of a window's textbox

    i'd like to get the handle of textbox. how can i do that?





    thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,960

    Re: how can i get the handle of a window's textbox

    Where is the textbox? In another program? What kind of program is it?
    Is it a DirectX game?
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Apr 2005
    Posts
    8

    Re: how can i get the handle of a window's textbox

    Quote Originally Posted by dglienna
    Where is the textbox? In another program? What kind of program is it?
    Is it a DirectX game?

    it's textbox of another window

  4. #4
    Join Date
    Jul 2005
    Posts
    10

    Resolved Re: how can i get the handle of a window's textbox

    Quote Originally Posted by HopeZ
    it's textbox of another window
    try this code Add A timer and set interval property to 1 and drop a Label too named Label1
    and move your mouse around the screen to know the Hwnd
    Code:
    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 Type POINTAPI
            X As Long
            Y As Long
    End Type
    Dim MousePNT As POINTAPI
    Dim X As Integer, Y As Integer, curWindow As Long
    Private Sub Form_Load()
    Label1.Caption = "Hwnd = "
    End Sub
    
    Private Sub Timer1_Timer()
    Call GetCursorPos(MousePNT)
    X = MousePNT.X
    Y = MousePNT.Y
    curWindow = WindowFromPoint(X, Y)
    Me.Caption = X & "/" & Y
    Label1.Caption = curWindow
    End Sub

  5. #5
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: how can i get the handle of a window's textbox

    Quote Originally Posted by HopeZ
    it's textbox of another window
    You can either use FindWindowEx API or the EnumChildWindows API. Take a look at www.allapi.net for the examples on these APIs.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center