Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8121561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T05:32:01+00:00 2026-06-06T05:32:01+00:00

I want to write an application that will automatically detect and fill the text

  • 0

I want to write an application that will automatically detect and fill the text field in the window shown below:

enter image description here

(assuming the data to be entered is in a file).

The question is how does my application find this text field?

I can do this job if I am able to find the location of the text field on the desktop through program.

Can someone help me understand possible ways for finding this text field?

I am using Windows Form application in C++.

Update:

I played with spy++.
I used spy++, to find the window handle. I did it by putting finder on the window I am interested in. Its giving handle in hex values: 00080086 (actually just for testing purpose I put the finder tool on Visual Studio new project page ). How do I interpret this Hex value into meaningful window name ?

See the below figure.
What is the next step to get to the text field ” Enter name” under “name” field.

****Any sample code will be highly appreciated.**

I am open to any solution not necessarily how I am doing this.

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T05:32:03+00:00Added an answer on June 6, 2026 at 5:32 am

    One solution is to use the Microsoft UI Automation technology. It’s shipped out-of-the-box with Windows since Vista. It’s usable from .NET but also from C++ using COM.

    Here is a short C++ console application example that displays the class name of the UI Automation Element currently at the middle of the desktop window, each second (you can have it run and see what it displays):

    int _tmain(int argc, _TCHAR* argv[])
    {
        CoInitialize(NULL);
        IUIAutomation *pAutomation; // requires Uiautomation.h
        HRESULT hr = CoCreateInstance(__uuidof(CUIAutomation), NULL, CLSCTX_INPROC_SERVER, __uuidof(IUIAutomation), (LPVOID *)&pAutomation);
        if (SUCCEEDED(hr))
        {
            RECT rc;
            GetWindowRect(GetDesktopWindow(), &rc);
            POINT center;
            center.x = (rc.right - rc.left) / 2;
            center.y = (rc.bottom - rc.top) / 2;
            printf("center x:%i y:%i'\n", center.x, center.y);
            do
            {
                IUIAutomationElement *pElement;
                hr = pAutomation->ElementFromPoint(center, &pElement);
                if (SUCCEEDED(hr))
                {
                    BSTR str;
                    hr = pElement->get_CurrentClassName(&str);
                    if (SUCCEEDED(hr))
                    {
                        printf("element name:'%S'\n", str);
                        ::SysFreeString(str);
                    }
                    pElement->Release();
                }
                Sleep(1000);
            }
            while(TRUE);
            pAutomation->Release();
        }
    
        CoUninitialize();
        return 0;
    }
    

    From this sample, what you can do is launch the application you want to automate and see if the sample detects it (it should).

    You could also use the UISpy tool to display the full tree of what can be automated in your target app. You should see the windows and other elements (text field) of this target app and you should see the element displayed by the console application example.

    From the pElement discovered in the sample, you can call FindFirst with the proper condition (class name, name, control type, etc…) to get to the text field. From this text field, you would use one of the UI Automation Patterns that should be available (probably TextPattern or ValuePattern) to get or set the text itself.

    The cool thing is you can use the UISpy tool to check all this is possible before actually coding it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to write a simple server application that will take commands from a
Say, I want to write a desktop application that will heavily use SVG. What
I want to write an application in Java that will communicate with Google App
I have a application that will capture the screen and I want to write
I want to write an application that removes data from a hard drive. Are
I want to write an Android application that can display some data received(polled) from
I want to write an application that will monitor the files that are modified
I want to write a new application that will use a DBMS. In the
I want to write an application that launches another app using Process.Start , but
I want to write an application that monitors a music player. In my app

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.