How do I programmatically set the caption of an external application?

Posted on 2011-05-07
Last Modified: 2012-05-11
Here is a screen shot of the application

Here are the properties of the "size" textbox as displayed in Spy++

Is there a simple command line C# application whereby I could set the size to a number of my choosing? (in the screen shot it is set to 400)

Question by:wordswithfriends
    LVL 13

    Expert Comment


    try the following code:

    public static extern bool SendMessage(IntPtr hwnd, int uMsg, int wParam, string lParam);

    const int WM_SETTEXT = 0xC;

    private void SetCaption(IntPtr hwnd, string caption)
        SendMessage(hwnd, WM_SETTEXT, 0, caption);

    Author Comment

    What parameter should I use for hwnd?
    LVL 13

    Accepted Solution

    the handle of the textbox you want to change it's caption. This appears in your properties.png.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    For Backups Guest OS files and indexing(and application awareness), Veeam needs Admin rights in Guest OS(Windows and Linux). In Windows a Domain Administrator account, and in Linux root access to perform this type of Backups and also Restore.
    VM backup deduplication is a method of reducing the amount of storage space needed to save VM backups. In most organizations, VMs contain many duplicate copies of data, such as VMs deployed from the same template, VMs with the same OS, or VMs that h…
    How to install and configure Citrix XenApp 6.5 - Part 1. In this video tutorial we have explained step by step installation of Citrix XenApp 6.5 Server on Windows Server 2008 R2 is explained in this video. We have explained the difference between…
    In this video tutorial I show you the main steps to install and configure  a VMware ESXi6.0 server. The video has my comments as text on the screen and you can pause anytime when needed. Hope this will be helpful. Verify that your hardware and BIO…

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now