Home > Mobile >  Qt window procedure for the first time, double-click the hidden operation interface, the second doub
Qt window procedure for the first time, double-click the hidden operation interface, the second doub

Time:10-04

Qt window procedure for the first time, double-click the hidden operation interface, the second double-click the display interface, and only run one instance how to implement?????

CodePudding user response:

First double-click hidden is very simple, add hide in Qt double-click events () to go,
Double-click on the display, want to ask next double-click?

Interface under the condition of no longer exists, if it is Windows with WindowsAPI get double click then process

CodePudding user response:

In fact, the program can only run a process technology, such as through the mutex (or other), started testing mutexes doesn't exist, create a mutex, and hide yourself, start the program again, mutexes, existing message before closing a process, is about the principle,

CodePudding user response:

Problem description is not very clear, is wants to be a single process or what do you mean?

CodePudding user response:

As said the second floor, creating a named semaphore, if not to run the program is running, and hide, if have the program runs, give it let it show, and then his exit

CodePudding user response:

Program can only run a process technology, using it the mutex

CodePudding user response:

reference 1/f, it is a nice nickname response:
first double-click hidden is very simple, add hide in Qt double-click events () to go,
The second double-click according to https://bbs.csdn.net/topics/393221678, want to ask next double click?
double click on the application of exe file

Interface under the condition of no longer exists, if it is Windows
It is good to use WindowsAPI get double click then process


double click on the application of exe file

CodePudding user response:

refer to 6th floor w22net response:
Quote: reference 1/f, it is a nice nickname response:

First double-click hidden is very simple, add hide in Qt double-click events () to go,
The second double-click according to https://bbs.csdn.net/topics/393221678, want to ask next double click?
double click on the application of exe file

Interface under the condition of no longer exists, if it is Windows
It is good to use WindowsAPI get double click then process


double click on the application of exe file


Then, add two main mark, did a used to represent the process is started, a used to represent any display interface,
Did the first step in the main test XXX. Exe, the existence of any (may need to be changed after startup process name) for interprocess communications, told the front to start the process: "I also launched a", and then turn off the process, before the window to show up after you receive the process can, show out again after receiving this message does not handle,

Can be ok?

CodePudding user response:

Interprocess communication in a socket should also can,

CodePudding user response:

What trouble? Why, one, using the shortcut way, similar to qq, CTRL + Alt + Z) 2, used the system tray, why must double-click to deal with, to use do not conform to the operation habit, also not convenient operation,

CodePudding user response:

refer to the eighth floor it is a nice nickname response:
interprocess communication in a socket should also can,

Two can be, there is also a way to use Shared memory

In addition, qt official class library encapsulates a QtSingleApplication, source code can be downloaded in qt's official website

CodePudding user response:

The Qt once there is a Solution is used to do this, basically said the above principle,

CodePudding user response:

Return card can get 10 points available every day
  •  Tags:  
  • Qt
  • Related