![]() Registered Member ![]()
|
I have a program written in C++ using a QTextEdit textbox. I have another program written in C#, which I need to access a QTextEdit that is in the C++ program. Is there a way possibly with using the QProcess class and Qyoto to get the text from this textbox? FindWindow/FindWindowEx windows api did not work.
Thanks Before Hand |
![]() Administrator ![]()
|
I would suggest building in a native mechanism into the C++ program to enable the C# program to retrieve the value of the textbox. This could be done via sockets, D-Bus, etc.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
![]() Registered Member ![]()
|
That would be great except for the fact that I do not have access to the source code for the C++ program. I only have access to the C# program's source code. The only way I see this possible is through some type of API. The QTextEdit box does have a CTRL-C(copy) and CTRL-S (select all). I was thinking if I can send the two commands and then get the text from the clipboard. Please let me know if that route is possible or if there is some other way using some type of SendMessage api to retrive the value of the textbox. Thanks before hand.
|
![]() Administrator ![]()
|
I'm afraid there won't be any sort of API - you'll need to rely on mouse/keyboard based interaction to extract the data you need from the C++ application. You could still automate this however.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
![]() Registered Member ![]()
|
I was able to resolve this using SendKeys command, select of all text (CTRL-A) and then a copy (CTRL-C) to the clipboard. I then retrieved the text from the clipboard into my C# program. No need to use Qyoto. Here is the code in case anyone is interested: (The only caveat is that the application cannot be minimized, even then there might be a way to maximize the application before sending the commands) Note: If you have more than one QTextEdit box, you might need to send some tab commands using SendKeys.SendWait("{TAB}") before you send the CTRL commands.
|
![]() Registered Member ![]()
|
|
Registered users: Bing [Bot], Google [Bot], Sogou [Bot]