Solved

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

Posted on 2004-04-25
8
237 Views
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?

wladq
0
Comment
Question by:wladq66
  • 2
  • 2
  • 2
8 Comments
 
LVL 5

Accepted Solution

by:
drnick earned 250 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,
drnick.
0
 
LVL 3

Expert Comment

by:CoolBreeze
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?

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

Author Comment

by:wladq66
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.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 3

Expert Comment

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

Author Comment

by:wladq66
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
0
 
LVL 5

Expert Comment

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

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
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.
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 …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

707 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

13 Experts available now in Live!

Get 1:1 Help Now