Paste From QT Window to Another Application Input Widget - c++

I am very new to C++ programming and the bulk of my program will be using the QT libraries. However, there is one part where I believe I will need to use Win32.
The scenario I want to code for is as follows:
I will have a QT application running. I want to be able to take some text which has been typed into a TextBox on the QT Window and paste that text into a TextBox in another application e.g. the address bar of Chrome, the address bar of Windows Explorer.
I want to be able to do that as a response to a button click on the QT Window. So, it would all happen in 3 steps. For example:
User types text into QT Window;
User places cursor in address bar of Chrome (Browser);
User clicks button on Window which pastes text into address bar of Chrome.
A nudge in the right direction would be most appreciated.
Edit - Additional Info
The application I’m building is a self-set assignment. I want to build a clipboard manager, similar to this old Delphi application http://www.joejoesoft.com/vcms/97/ . It will run in the system tray, in a minimised state.
The user, will put their focus into a text input in some application
which is running on their Windows machine e.g. Notepad.
Then, they will hit a hot key combination which will open a form (my QT Window.
The application will have been collecting clips as the user presses Ctrl-C (or by right-clicking) and those will be listed in that QT Form (just like the app in the link above).
The user then clicks on the particular item that they want paste and it will be pasted into the original input that they had put the cursor into.
Further Edit - further info
I'll break step 4 into a couple of sub-steps as it is causing confusion:
The user then clicks on the particular item that they want paste
Focus changes from QT Window back to the window of the other Win32 application which originally had focus
Content is pasted into the input control which now has the focus
I pretty much know how I can gather up items when the user copies things. But I have no idea how I will paste from my application to the target application.
Cheers

Related

Windows 10 - Taskbar - Add item to context menu for each program

I need a context menu entry for each program in the taskbar. Want to add an entry which immediately terminates (UNIX/Linux-like signal SIGKILL) the process. There a lot of questions on this site, how it's done for the explorer or desktop. But is it also possible to add such an option to the context menu of the taskbar?
To clarify the question, according to my comments:
The current problem:
I have a program (not Firefox) which randomly crashes. The program is in fullscreen mode. But if I want to close the window of the program with Exit window, it takes a long time that Windows kill the program. When I try to open the Task Manager the program immediately grabs the user input and I have no chance to interact with the Task Manager. So my solution was to add a context menu item in the taskbar to quit the task of the program. According to a user comment, I test the option "Always on top" in the Task Manager. Didn't know that. But I haven't tried it yet. I'm also interested for further projects, if there is a function in WINAPI or Windows Registry to add an item.
To avoid down-votes:
I'm not interested to hack Windows or the application. Solutions with code injection are taboo for me. Want a clean solution, if even possible. I want improve my Windows version. Adding also some additional information (process information) in the context menu.
Have currently found this (Registering shell extension handlers).
Has anybody used this before? I think it's sound promising.
There is no API to extend this menu like that. Applications can customize the top of the menu with ICustomDestinationList but there is no way to add entries for all applications.
For a personal use project, you could inject a .dll in the taskbar instance of Explorer.exe and add your item after figuring out the address of the function where the menu is created. This address can of course change after you upgrade Windows so it is not a very generic solution. Using the public symbols might help but you still have to expect it to break from time to time when Microsoft changes part of their taskbar code.
You don't need to change code in explorer.exe, because you can close a program by doing the keyboard shortcut: Alt + F4.

Qt5: How to create interrupt driven gpio button based qt app

My problem is......... I am trying to develop an application.In this application there are certain pages and which is displaying on the LCD on my board.and my board has a gpio button by default the value of this button is high when i press this button value of this button become low after releasing again high.i want to make my app interrupt based when i pressed hold button for 3 second display should be rotate and if i just press and release button page should change.In my app i have interface my gpio button.
QString btnInput = "/sys/class/gpio/gpioN/value";
In my apps I can read the value from value file when my app start after that if i press button nothing will happen.what should i do.
how can i generate interrupt after pressing button.
please help me i am new in qt I start qt just before 2 week.
I can't tell for a Qt5 application actually (I don't have experience in the Qt field), but you may use a inotify file watcher with /sys/class/gpio/gpioN/value in user space.
That way your program will receive notifications (interrupts) whenever the value changes.
I'm almost sure there's also some (portable) Qt intrinsic mechanism, that resembles the same.
Update (after a little research):
Specifically for Qt I found this answer where the QFileSystemWatcher is mentioned for doing that portably.

Setting AdvancedPrintingOptions from C++ code

I'm working with my friend to create a simple Photo Booth device. We are using DNP RX1 Printer, and this printer has the ability to cut photos in half.
When printing photos directly from windows cutting can be set as Enabled/Disabled via "Advanced Options" window in Printer Properties.
How to Enable/Disable Cut (2inch cut)
I'm working on application for this Photo Booth device (Developed on Windows 7). I'm using C++ and Qt as my GUI framework. There is a QPrintSupport module in Qt library that can be used to print images from my application, and I know how to do it. But the problem is that there is no way to Enable/Disable this "cut photos in half" option using Qt library. It is possible to display settings window to user using QPrintDialog class, but I want the process of taking photo and printing to be automatic ( User only press start button, smiles and waits till photo comes out). My workaround for this problem was to save files to two folders, and use different program to print photos from the first folder with cut option enabled and from the other folder with cut option disabled. But the problem was that printer was sometimes detected as DS-RX1 and sometimes as "DS-RX1 (Copy)" or even "DS-RX1 Copy 1", then this solution didn't work and someone had to manually delete printer from the system and reconnect it.
My question is: Is there a way to print a photo from C++ program using default printer and change this Advanced Printer Option (2inch cut) from C++ code? OR: Is there a way to force this printer to be detected always as DS-RX1?
Maybe you can set priner by substring "DS-RX1".
You can get list of available printers http://doc.qt.io/qt-5/qprinterinfo.html#availablePrinters by substring and as a variant you can set printer by setPrinterName function http://doc.qt.io/qt-5/qprinter.html#setPrinterName

Adding custom controls to a console window

Is it possible to add custom controls to a console window? You can use GetConsoleWindow() to get the window's handle, and then add your own menu items or consume all its events. I can't find any examples of people adding extra controls though.
I am developing a small, high performance serial terminal app. It is a console application - RichTextBox is too slow and has issues that make it unsuitable for VT100 terminal emulation.
I want to add some little graphics to show the state of the serial control lines (RTS/CTS/DTR/RI etc.) and perhaps a capture on/off toggle button. Ideally I'd like to add them to the window title bar. Bitmaps are all that are required.
After lots of research I found that it isn't easy, or even possible really.
You can add controls to the window with CreateWindow(), but of course only in the client area which is taken up entirely by the console text box. However, you can at least create floating controls that way, which hover over the text to provide status info etc.
You can put controls in the window borders but only with some hacking on XP or a new API that was introduced with Vista. The problem with this API is that it requires you to draw your own program icon and title text, and the console window doesn't seem to cope with it very well.
You can't add your own menu items because the console window doesn't pass the messages.
In the end I used the function keys for everything and gave a status indication by changing the console window icon.

Paste Text from clipboard to Text box in focus of browser using MFC application

I have an application which copies the Email Id to clipboard in my application.
What i want to next is, When the user clicks on the textbox of the Browser(IE,Chrome,FF) And presses the paste button of my application , it should paste the contents of the clipboard in that focused TextBox. Please Note that my Application is Created in MFC, c++. I have Implemented code for copying the text to clipboard from within my application, but am wondering how will it be possible to paste the text outside my application , when the event is fired from my application. If question is not clear please comment it. Your Help will be highly appreciated.
Thanks In Advance.