Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Change the value of a textbox/label/etc from another program with Visual Basic...

Posted on 2004-04-25
Medium Priority
Last Modified: 2013-11-13
I have a program with some controls on it.
I want to make another program that can change the values of a text box, for example in the first one. They will be two exe's.

can this be done via windows api functions?

Question by:wladq66
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2

Accepted Solution

drnick earned 1000 total points
ID: 10912931
i think so.
you need to these steps:

get in your "changer" app a handle to the editbox/lable (which both will be windows)
and then send the new text via SendMessage/PostMessage with WM_SETTEXT.

to get the handle can be messy, got to use stuff like FindWindow or GetForeGroundWindow or EnumWindows,

it could also be that you need to transfere your string into the other processes address space,
if so, you'll need VirtualAllocEx and WriteProcessMemory, however, i'm not sure of that.

to sum up, what you want to do is complicated, unsecure and version-compatibility-horror.
maybe try to work around this problem,
the use of normal IPC, shared memory or DDE or such will be safest.

hope i could helf anyway,

Expert Comment

ID: 10925473
why is there a need to transfer his string into the other process space?
I thought WM_SETTEXT will take care of that?

it would help if there is certain prominent characteristic for you to identify
the textbox you want.

Author Comment

ID: 10926137
is it easier to just simulate clicking somewhere? [that would be alot of help].. to select a menu and click file->others->input [just as an examples].. then use wm_settext to set the text in the window it appears.
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Expert Comment

ID: 10926217
to wm_settext, you need the handle of the window, so you still have to do it like what drnick says

Author Comment

ID: 10977680
but if i need a button [normal one, not menu] and then click on the menu that apperas? or what about simulating clicking clicking on file->etc ?then what? could u help? i will increase thhe points

Expert Comment

ID: 10980388
in that case it will maybe easier to simulate keystrokes with the
i assume that you can control the program by keyboard-commands,
like the most common programs.

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
If you are a mobile app developer and especially develop hybrid mobile apps then these 4 mistakes you must avoid for hybrid app development to be the more genuine app developer.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

719 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