Ten thousand d the different speed of software, the application can be released, then through its client visit,
Search, I feel he should be using the server terminal services, please master, how can you make the application is not running terminal environment,
Because of this, through the different speed of software, the application can't control client number, installation of a site, can use a lot of people, that's terrible!!!!!!
Consult everybody how can you avoid this situation??? Thank you very much
CodePudding user response:
Can only run one instance
CodePudding user response:
refer to the original poster zhangyangziwo response: ten thousand d the different speed of software, the application can be released, then through its client visit, Search, I feel he should be using the server terminal services, please master, how can you make the application is not running terminal environment, Because of this, through the different speed of software, the application can't control client number, installation of a site, can use a lot of people, that's terrible!!!!!! Consult everybody how can you avoid this situation??? Thank you very much I studied the different speed of this software, should adopt the terminal services, control your program runs only one instance, by the mutex is not feasible, because each program running in a different session, you can use the files or registry to control such as the program runs only once, such as program timing for 5 seconds to write a file, such as c: \ 1. TXT, write in this file, the current time to judge when program is running, if the file in time compared with the current time is not more than 5 seconds, were not allowed to program is running, tip has been running, then quit, CodePudding user response:
Thank moderator reply, I try CodePudding user response:
For more than a year, through registries before check whether to install the software to control, was found to evade the past now Just find a API, should be able to solve this problem fundamentally Consult the API WTSQuerySessionInformation how to define? Test, take the user name is the code? CodePudding user response:
There are two API can The Function Ulong GetCurrentProcessId () Library "kernel32. DLL" Alias for "GetCurrentProcessId "The Function Ulong ProcessIdToSessionId (Ulong uProcessid, ref Ulong myid) Library "kernel32. DLL" Alias for "ProcessIdToSessionId "Myid is non-zero, if the return is running in the terminal, a terminal connected when there will be a different session ID, your site and it is ok that the ProcessIdToSessionId (GetCurrentProcessId (), ref ll_session) Ll_session is terminal session ID, each terminal connection up when only a logo CodePudding user response:
reference 5 floor pb8 reply: it is ok to have the following two API The Function Ulong GetCurrentProcessId () Library "kernel32. DLL" Alias for "GetCurrentProcessId "The Function Ulong ProcessIdToSessionId (Ulong uProcessid, ref Ulong myid) Library "kernel32. DLL" Alias for "ProcessIdToSessionId "Myid is non-zero, if the return is running in the terminal, a terminal connected when there will be a different session ID, your site and it is ok that the ProcessIdToSessionId (GetCurrentProcessId (), ref ll_session) Ll_session is terminal session ID, each terminal connection up when only a logo Educated, CodePudding user response:
reference 4 floor zhangyangziwo response: for over a year, by registered list before check whether to install the software to control, was found to evade the past now Just find a API, should be able to solve this problem fundamentally Consult the API WTSQuerySessionInformation how to define? Test, take the user name is the code? In such a way I can only say that oneself, //it is clearly not the best, but at least in a stupid way, //will you use a year's time to find the answer to a question, and prove that it is important, so it's silly method, are also worth a try, I use hardware encryption dog (even the most low-end, TAOBAO on a few dollars a kind), it has a Shared memory, (which may be a few K or even 4 bytes) You put up, the whole machine, even on the Internet, no matter how many copies are used only that a memory, Wrote A copy of the "A", A copy of the B read also must be "A". As soon as the program up, write your own a "random number a," read not write their own "random Numbers a", will know that there are multiple copies in the running, CodePudding user response:
Domestic god really nothing RD effort is OK as long as a software