473,385 Members | 1,630 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

SendKeys problem

hello, is it possible to use SendKeys in c# to send a listbox item from the form to a textbox in another application? Im trying to use SendKeys because after weeks of trying to use API with my framework 2.0, Im fully convinced that it is either impossible to do or know one knows how, so i thought maybe SendKeys would be easier. thanks in advance!
Feb 11 '06 #1
1 2078
try this just an example that will clear your concepts

Dim hWndApp As LongDim sApplication As StringDim hWndChild As LongDim sBuffer As String * 32Dim nSize As Long hWndApp = FindWindow("ThunderRT6FormDC", "Password")hWndButton = FindWindowEx(hWndApp, 0, "ThunderRT6CommandButton", "&Ok")hWndChild = FindWindowEx(hWndApp, 0, "ThunderRT6TextBox", "") If hw ThenhWndChild = GetWindow(hWndApp, GW_CHILD) Do While hWndChild <> 0 'get the Class Name of the window nSize = GetClassName(hWndChild, sBuffer, 32) 'MsgBox hWndChild 'if nSize > 0, it contains the length 'of the class name retrieved If nSize Then 'if the class name is "Edit", 'set some text and exit If Left$(sBuffer, nSize) = "ThunderRT6TextBox" Then Call SendMessage(hWndChild, WM_SETTEXT, 0&, ByVal passcode) hWndChild = GetWindow(hWndChild, GW_HWNDNEXT) Call SendMessage(hWndChild, WM_SETTEXT, 0&, ByVal login) Call SendMessage(hWndButton, BM_CLICK, 0, 0) Exit Sub End If End If 'not found, so get the next hwnd hWndChild = GetWindow(hWndChild, GW_HWNDNEXT) Loop End If
Sep 12 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: David Kanter | last post by:
Hello, I have a question regarding SendKeys(). I am working on a small VB .Net script that manipulates/automates programs through SendKeys(). Unfortunately, I have run into several problems. ...
6
by: Mr. Bungle | last post by:
I would like to send email automatically via a command button. I have accomplished this just fine through the following code: (Outlook should already be open for reliable results) Private Sub...
2
by: RBohannon | last post by:
I need to create a report in MS Word populated with data from A2K. I have been asked to create the report in Word so that parts of it can be edited as necessary later. The data in the report are...
5
by: Mike | last post by:
I want to be able to open the printer popup screen while a report is on the screen. I would like to have a button on one of the menus that sends the "control P" combination. In the past, I...
5
by: Wayne Gibson | last post by:
Hi, Was wondering if somebody could help.. I'm trying to use Sendkeys on a Windows forms. I have entered the following command to simulate a CTRL+ALT+1.. ...
1
by: Bryan | last post by:
I am writing a C# Windows App that updates out Excel reports' modules. The app is complete, but has a problem. The only way MS allows you to unprotect the VBA code in Excel is to do it by hand or...
2
by: David Kanter | last post by:
Hi, I am relatively inexperienced with VB.Net, but I am familiar with many concepts from programming; I have some basic level of competence with C/C++ and Perl, but I just started using VB this...
6
by: Michael Maes | last post by:
Hello, I'm invoking successive SendKeys.SendWait("{BACKSPACE}") SendKeys.SendWait("{DELETE}") in a loop. The issue is that it causes a Beep on every Pass. Setting the 'Handled = True' on...
0
by: neonspark | last post by:
I'm buidling some simple macro functionality for my app so the users can record a sequence of keyboard inputs and replay them reliably via some menu. Originally, I used: protected override bool...
0
by: jairathore | last post by:
Hi, I m working on a project on which my requirment is like that remotely i control another application by using sendkey.sendwait method, i m sending some keystroke to that application and...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.