Getting a value of a textfield from another application in Qt C++ - c++

I am just wondering is there a way to get
the value of a textfield from another
application?
Windows OS
For example in window a textbox2 has a value of 1.
How would i get the value of textbox2 from another application then?

Read up on IPC. You should be able to find a solution on that webpage that suits your needs.

In general, if you want to send information between to applications there are a number of ways to do it. Depends entirely on you circumstances. Why don't you try a search here on SO? There are many related questions:
Passing information between two seperate programs
Elaborate your question or search for yourself.

You can use Windows APIs to get the handle of the target window and get its text. Look for
FindWindowEx or EnumWindows Win32 APIs for this purpose.
Remember that this solution only works for Windows you can not port it to Linux!

If you are looking for a generalized solution that will work between two applications across different platforms and machines (i.e. Window 1 is on a Windows PC, Window 2 is on a Linux PC), check out libQxt and it's IPC classes. Specifically, you might want to look at QxtRPCPeer.

Related

Clipboard not found in UWP

I'm currently working on a project consisting of one program which tracks faces (which we got from https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/BasicFaceTracking), which is a Windows Universal App and our program, which is supposed to get the number of faces recognized and reacting appropriately.
I thought about copying the number of faces detected by the facetracking program to the clipboard and just reading it from the program.
The problem I have (which might actually be really simple) is that I can't seem to get to the Clipboard Class from within the UWP app.
Using OpenClipboard(NULL) or similar but I always get the error that the IDentifier is not found, no mater which header I include or not...
Can anyone give me a clue what to do? Or maybe a better alternative to transfer that one tiny int from one program to the other?
Thanks in advance.
janine
For UWP applications you should use Clipboard class.
OpenClipboard is an old Win32 API that is only available to desktop applications as mentioned at corresponding MSDN page:
Minimum supported client Windows 2000 Professional [desktop apps only]

Controlling Firefox from C++

I am running Mozilla Firefox on Windows 7 and would like to be able to send simple commands (New Tab, Minimize, Close Tab) to it from a C++ program.
The usual question of inter-process communication, when both processes are a part of the same user program, seems to be answered by Boost.Interprocess.
But what about actually controlling the GUI window of an entirely independent application (Mozilla)?
You can use Spy++ to debug what messages each action will produce, then replicate those messages in your program.
You can use Ranorex http://www.ranorex.com, Quick Test Pro http://www8.hp.com/us/en/software-solutions/unified-functional-testing-automation/index.html#.UpvC8OJO7tw
Will give you this ability
The general answer to controlling any Windows program through its user interface is by sending it Windows messages. There are also some rather specific Windows APIs that allow you to send specific kinds of inputs directly to the keyboard, mouse or other input device.
Assuming simple requirements, you should be able to control Firefox by sending it some combination of the messages WM_[SYS]KEY[DOWN|UP], WM_[L|R]BUTTON[DOWN|UP] or similar. You may also need to use FindWindow and other things to find where to send messages. And liberal use of Spy++ to figure out what to send and where to.
Actually, what I would do is start with AutoHotKey. It can do all this stuff and then some, and it has a massive community. It's GPL so you can find out how it does stuff and there are people there to ask for help.

How to shell to another app and have it appear in a Borland VCL form (c++)

I'm actually in charge of a FIP networking c++ application, working for the first time with Embarcadero C++ Builder XE5.
The app is nearly finished, but I can't find how to implement the last feature...
I wanted to open an external Windows HyperTerminal in order to see what happen on a given COM port, for this purpose I'm using ShellExecute() to launch it from my application but it's a bit ugly since there is 2 different windows.
I was wondering if it was possible to integrate this newly opened HyperTerminal into an existing form (Panel for instance). I couldn't find nothing related excepted this =>
Delphi style, but i don't understand a byte of #mghie answer since it's delphi.
If anyone have a clue I'm really interested, even the most basic clue!
For almost all of my projects where COM port interaction is needed I use AsyncPro. The project is very well documented with a ~1000 page reference manual.
Reference Manual
Developer's Guide
For this case, the package provides a VCL terminal that simply drops onto a form. It's quite flexible with a lot of options to configure its behaviour.
I wanted something similar in past but with no success.
1.The only thing I was able to do is the exact opposite.
dock my VCL window inside another (not VCL app) but that solved my problems
If you terminal is console window then I doubt even this can be done.
anyway find handle of desired window
find handle to a dockable subcomponent
set the parent of your subwindow to it / or use manual dock
2.maybe you can do some funny stuff
like hide terminal somewhere
and continuoslly copy its graphics to your window
newer done that hide thing
but copy the contents is doable (although on windows a little unstable sometimes)
done it once to feed my App with IR-camera feed from different App
while 'focus' stays on hidden terminal it should work
also you can try to post messages to it somehow if you need the focus ...
Sorry for a vague answer but at least you see some approaches of mine
maybe someone has a better way to do this

How can I check if a process has a graphical interface (without .NET)?

I'm trying to understand which processes has the graphical interfaces. I was trying to use GetGuiResources, but some of the processes have GUI resources but don't have the window. Now I use WaitForInputIdle - the same, some of the processes ready for input, but they don't have the window :(. How can I check if a process has a graphical interface?
P.S. I use Python + ctypes, but example on C++ or small explanation what should I use will be enough :)
If your target is Windows you can use Win32 API. EnumWindows function enumerates child windows, or alternatively you can use EnumThreadWindows to enumerate only the non-child windows.
I hope this can give you some help.

Detecting new device insert in C++

I've tried to find a way to detect when a new device (like a USB) is inserted into a computer, but everything I've seen required MFC, which I don't have. Is there a way to do this without MFC? If not, I understand, but I haven't seen anything of the like in my Google searches.
Thanks,
C++ by itself does not have any platform-dependent hardware-level functionality. You will need to use some API, like Win32 or MFC or .NET on Windows.
You can do this using libusb and there's a port of libusb for win32, so you might have some luck using that instead of MFC, with the added bonus of being more portable.
Handle the WM_DEVICECHANGE message.
See http://msdn.microsoft.com/en-us/library/aa363480(v=vs.85).aspx
EDIT: Of course, this is Windows only, which the OP didn't specify. There's no way to do this without external libraries or platform specific APIs.