473,395 Members | 1,466 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,395 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 2079
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.