Interactions with other application [closed] - c++

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I'm a learning c++, I want to know that how programs are made that can interact with other application in windows.By interaction I mean like clicking a button, giving keyboard input, changing settings of that application, changing options or even editing or creating files.How can I make such Programs in C++?

How you interact with other applications depends on your OS. If e.g your application runs on windows you have to use the Win32 API. The Win32 API are functions provided by the OS allowing you to interact not just with other applications but also with the OS itself, e.g to set up windows or to open files.
Win32 provides a messaging system. Every application has a message loop and accepts messages from the OS (e.g about mouse clicks) but can also receive messsages from other applications. The receiver cant decide whether the message comes from the OS or from another process.
To e.g change the title, you have to send the other application a WM_SETTEXT message using the SendMessage function.
Directly interacting with another application (changing its values, not just modifying the GUI) is just possible, if the application provides some kind of interface. These could be a network connection, named pipes, shared memory or some module/plugin loading mechanism (through dlls). Otherwise its not possible (easily).
For UNIX based OS an API called POSIX exists providing similiar functionality as Win32.

Related

Control the external program to generate output with Qt program in C++ [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I have seen a few sample of running .exe file in a Qt program but is it possible to invoke the functions in the external program?
For example, external program A is an existing application which receives input and generates output. Program A requires the users' interaction with the GUI of Program A in order to work. How do I pass the input to program A and get output for my current Qt program without showing and using the GUI of Program A.
actually you can and this is knonw in the it world as IPC
every Operating Sytem has some interfaces to allow you to do that and qt has some concrete implementations of these. (https://doc.qt.io/qt-5/ipc.html)
Inter-Process Communication in Qt
TCP/IP
Local Server/Socket
Shared Memory
D-Bus protocol
QProcess Class
Session Management
but this is not going to work out of the box, you need to "enable" such capabilities in your qt app and the 3rd app triggering the methods must be:
able to call IPC interfaces,
able to know what interfaces are exposed by your qt app (what is the signature of the method etc etc)

Reading input on c++ server in real time [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I want to write a server in C++, I would connect to this server via Netcat or Telnet. Server would send a menu to a client and client would navigate using the arrows to choose an option. My question is: how can I get char-messages in real time (not after clicking Enter) from client?
C++ standard library has no API for keyboard input. There is only API for streams, which do require pressing enter (or EOT).
Implementing direct keyboard input on POSIX shell is quite tricky, and I would instead recommend using an existing library.
In particular, an implementation of the curses library will have a getch function that you can poll in a loop.

C++ Windows API Syscall Hook Example [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Im just starting to learn C++ programming and for exercise I want to learn how to write Windows API Syscall Hook. For example, if I will try to delete a file with a specific name, for exmaple 'test.txt', then instead of deleting it a message would pop up. I tried searching for a tutorial on how to do something like that but I couldn't find anything.
Maybe someone could share a link to a tutorial on how to do something like this or maybe a very simple code example?
I am working on Windows 10 machine and Visual Studio 2015.
Write a File System (Mini-)Filter Driver.
https://msdn.microsoft.com/en-us/library/windows/hardware/ff548202%28v=vs.85%29.aspx
A file system filter driver is an optional driver that adds value to
or modifies the behavior of a file system. A file system filter driver
is a kernel-mode component that runs as part of the Windows executive.
A file system filter driver can filter I/O operations for one or more
file systems or file system volumes. Depending on the nature of the
driver, filter can mean log, observe, modify, or even prevent. Typical
applications for file system filter drivers include antivirus
utilities, encryption programs, and hierarchical storage management
systems.
The windows driver samples contain a minifilter driver to detect deletions of files or streams.
See: https://github.com/Microsoft/Windows-driver-samples/tree/master/filesys/miniFilter/delete

c++ debug logging on windows [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I am curious as to what is the most common and/or accepted way of logging debug print info for a c++ win32 application on Windows. I am not using visual studio, and am compiling with GCC.
I am used to developing on Android, and writing and monitoring logs using logcat.
Is there something like this for win32?
EDIT:
Is it most common to use something like this?
https://msdn.microsoft.com/en-us/library/6xkxyz08.aspx
Although it does not provide the added functionality of filtering and daily / size rollover OutputDebugString is a good API that allows you to send debug logging messages.
The output can be retrieved and displayed with a special program, when the program is not started the output simply gets ignored.
Read more about it in this article: How to view output of OutputDebugString? (the same API call can be used from C++)
Depending on the size of the output you might want to use Eventlog of Windows or a logging framework like
http://log4cpp.sourceforge.net/
The standard infrastructure for logging in Windows is Event Tracing. It is available (and used) in all parts of the OS, both by user mode applications and kernel mode modules:
Purpose
Event Tracing for Windows (ETW) provides application programmers the ability to start and stop event tracing sessions, instrument an application to provide trace events, and consume trace events. Trace events contain an event header and provider-defined data that describes the current state of an application or operation. You can use the events to debug an application and perform capacity and performance analysis.
Where applicable
Use ETW when you want to instrument your application, log user or kernel events to a log file, and consume events from a log file or in real time.
Developer audience
ETW is designed for C and C++ developers who write user-mode applications.
Run-time requirements
ETW is included in Microsoft Windows 2000 and later.

How to capture audio from specific application and route to specific audio device in Windows 7? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
The community reviewed whether to reopen this question 6 months ago and left it closed:
Original close reason(s) were not resolved
Improve this question
Ok, my question is this:
How can I programmatically capture audio from a specific application and then send it to a specific audio device in Windows 7?
I know for a fact this can be done, since SoundLeech captures audio from individual programs, and theoretically once you have the sound you can do what you want with it (including play it to any sound output device).
I'm a C++ programmer but I know very little about Windows programming. I need some pointers to capturing sound from individual programs. I work with audio recording very frequently and I would be willing to put in a large amount of work to develop a way to better handle sound in Windows given how difficult to use it currently is.
So how can I capture audio streams directly from applications without first routing them through Virtual Audio Cables or the like?
You cannot do it using standard user mode APIs. You need to either hook APIs or create virtual devices to accept application streams/sessions.
Intercepting and postprocessing all audio streams on Windows
Recording Audio Output from a Specific Program on Windows
Is it possible to caputre the rendering audio session from another process?
Capture audio of a single application on Windows 7