Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
single instance run
#1
I need the generated exe to run as a single instance.

The following two functions are not working:
The functionality that exeThread_Test1 needs to implement: when the exe is run again, execute the subfunction (sub.osdTip).
The functionality that exeThread_Test2 needs to implement: when the exe is run again, restart the exe (first perform a soft close, then start it again).

Thanks in advance for any suggestions and help.

Function exeThread_Test1
 
Code:
Copy      Help
;allow single instance
if(getopt(nthreads)>1)
,sub.osdTip
,ret

sub.osdTip

AddTrayIcon "cut.ico" "test_TcpSocket_server[]Ctrl+click to end."
#compile "__TcpSocket"
TcpSocket x.ServerStart(5032 &sub.OnClientConnected)

#sub OnClientConnected
function TcpSocket&client $clientIp param !*reserved

client.Receive(_s 1000)
out F"SERVER: client request: {_s}"
client.Send("response 1")

#sub osdTip
OsdHide "o1" 
OnScreenDisplay "TcpSocket_server is Running!" 0 0 0 "" 36 0x33331F 4|8|128 "o1" 0xFFFFFF

Function exeThread_Test2
Code:
Copy      Help
;allow single instance
if(getopt(nthreads)>1)
,;shutdown -2 ;;not work
,shutdown -7
,run ExeFullPath
,ret

sub.osdTip

AddTrayIcon "cut.ico" "test_TcpSocket_server[]Ctrl+click to end."
#compile "__TcpSocket"
TcpSocket x.ServerStart(5032 &sub.OnClientConnected)

#sub OnClientConnected
function TcpSocket&client $clientIp param !*reserved

client.Receive(_s 1000)
out F"SERVER: client request: {_s}"
client.Send("response 1")

#sub osdTip
OsdHide "o1" 
OnScreenDisplay "TcpSocket_server is Running!" 0 0 0 "" 36 0x33331F 4|8|128 "o1" 0xFFFFFF


Messages In This Thread
single instance run - by Davider - 06-12-2025, 01:39 AM
RE: single instance run - by Gintaras - 06-12-2025, 02:02 AM
RE: single instance run - by Davider - 06-12-2025, 02:34 AM
RE: single instance run - by Gintaras - 06-12-2025, 02:40 AM
RE: single instance run - by Davider - 06-12-2025, 06:41 AM
RE: single instance run - by Gintaras - 06-12-2025, 07:01 AM
RE: single instance run - by Davider - 06-12-2025, 10:58 AM
RE: single instance run - by Gintaras - 06-12-2025, 11:12 AM
RE: single instance run - by Gintaras - 06-12-2025, 11:20 AM
RE: single instance run - by Davider - 06-12-2025, 09:28 PM
RE: single instance run - by Gintaras - 06-13-2025, 02:03 AM
RE: single instance run - by Davider - 06-13-2025, 10:35 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)