VB send information to window handle w/o SendKeys

Posted on 2005-04-19
Medium Priority
Last Modified: 2010-05-02
Here's the skinny -->

* I've a known window handle to where I want to send a piece of data from my pre-existing VB app.
* It is ten characters (all numeric)
* There also needs to be a CR to submit the query.  It is not a web based application.
* Sendkeys = BAAAAD!  

I can grab the window handle, but sending to that window handle (caption, text or window handle) is... ahem... throwing me for a Loop.  Sorry, couldn't resist.  
Question by:chitterbutt
  • 3
LVL 13

Accepted Solution

rettiseert earned 500 total points
ID: 13819305
"The SetWindowText function changes the text of the specified window’s title bar (if it has one). If the specified window is a control, the text of the control is changed."

Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long

LVL 29

Expert Comment

ID: 13819387
Use an API spy...There is one called PAT or JK's API spy, This will give you many options to choose from and to do whatever you want with the windows.  It also will actually write the source code for you so you can simply copy and paste the code into your application.

For what you describe the options you would need are...findwindow,settext,gettext etc..

It's very simple to use give it a try...

download here::


Author Comment

ID: 14223819
LVL 29

Expert Comment

ID: 14223980
Whats terrible?
LVL 29

Expert Comment

ID: 14223987
Sorry to inform you bit sendkeys is the only terrible thing here buddy

Featured Post

Technology Partners: 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!

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

850 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