Click here to Skip to main content
16,004,944 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
QuestionSingle-instance applications and batch files Pin
supercat915-Jul-09 5:59
supercat915-Jul-09 5:59 
AnswerRe: Single-instance applications and batch files Pin
Luc Pattyn16-Jul-09 1:36
sitebuilderLuc Pattyn16-Jul-09 1:36 
GeneralRe: Single-instance applications and batch files Pin
supercat916-Jul-09 13:20
supercat916-Jul-09 13:20 
GeneralRe: Single-instance applications and batch files Pin
Luc Pattyn16-Jul-09 13:26
sitebuilderLuc Pattyn16-Jul-09 13:26 
GeneralRe: Single-instance applications and batch files Pin
supercat917-Jul-09 4:41
supercat917-Jul-09 4:41 
GeneralRe: Single-instance applications and batch files Pin
Luc Pattyn17-Jul-09 11:40
sitebuilderLuc Pattyn17-Jul-09 11:40 
GeneralRe: Single-instance applications and batch files Pin
supercat917-Jul-09 13:21
supercat917-Jul-09 13:21 
GeneralRe: Single-instance applications and batch files Pin
Luc Pattyn17-Jul-09 13:57
sitebuilderLuc Pattyn17-Jul-09 13:57 
Hi,

interesting idea.

I'm not inclined to use TCP/IP for local purposes as it may pose problems selecting channels, avoiding conflicts, configuring firewalls, etc; risks which aren't necessary as you can use named pipes equally well. And you need only one per singleton.

So the singleton-enforcer could be a console app with the following syntax:
enforce1 filename.exe command_line_arguments

This enforce1 would:
1. algorithmically derive a pipe name form the filename.exe
2. look for a process P currently executing filename.exe, and if none found, launch filename.exe as a process P without arguments;
3. send its process ID and the command_line_arguments to P
4. wait for a return status, which I would transmit using a Windows message (based on PID).

all of the above is independent of the exe's functionality. enforce1 is general-purpose.

the target exe should ignore its command line; it must open and listen to the named pipe (again derived from the EXE name), expect to receive a PID+command line, and when done send a Windows message to process P with given PID to return the 32-bit result status; and loop waiting for another piped command. It may or may not use multithreading to perform several jobs concurrently.

The piped message is a command line, that should be short enough to be atomic. So all enforcers can send to the same pipe without fearing collisions/confusion.

One might consider a non-console version of the enforcer too.

BTW: all of this does not solve my earlier quest for a single exe offering an app that acts as both console and non-console, since 1) it is two or three EXE (one universal), and 2) the console part is universal, hence ignorant of the actual application (it can't provide help for instance).

Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]

The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.

GeneralRe: Single-instance applications and batch files Pin
supercat920-Jul-09 4:56
supercat920-Jul-09 4:56 
QuestionSpell Check Recommendations Pin
musefan15-Jul-09 5:11
musefan15-Jul-09 5:11 
AnswerRe: Spell Check Recommendations Pin
Luc Pattyn15-Jul-09 6:30
sitebuilderLuc Pattyn15-Jul-09 6:30 
GeneralRe: Spell Check Recommendations Pin
musefan15-Jul-09 6:43
musefan15-Jul-09 6:43 
GeneralRe: Spell Check Recommendations Pin
Luc Pattyn15-Jul-09 6:45
sitebuilderLuc Pattyn15-Jul-09 6:45 
Questionhow to pass values from pop-up window(child page) to a master page(parant page) datagrid? please help me out [modified] Pin
staycool_khan15-Jul-09 4:11
staycool_khan15-Jul-09 4:11 
AnswerRe: how to pass values from pop-up window(child page) to a master page(parant page) datagrid? please help me out Pin
Not Active15-Jul-09 4:56
mentorNot Active15-Jul-09 4:56 
QuestionHow to create static library in C++ .net 2008 and call it from VC6 Pin
stefanidou15-Jul-09 1:46
stefanidou15-Jul-09 1:46 
AnswerRe: How to create static library in C++ .net 2008 and call it from VC6 Pin
Ravi Bhavnani18-Jul-09 6:13
professionalRavi Bhavnani18-Jul-09 6:13 
QuestionHow can patch .NET assembly code Pin
ham_tim_hieu14-Jul-09 21:29
ham_tim_hieu14-Jul-09 21:29 
AnswerRe: How can patch .NET assembly code Pin
Luc Pattyn15-Jul-09 2:55
sitebuilderLuc Pattyn15-Jul-09 2:55 
AnswerRe: How can patch .NET assembly code Pin
harold aptroot15-Jul-09 5:09
harold aptroot15-Jul-09 5:09 
GeneralRe: How can patch .NET assembly code Pin
ham_tim_hieu15-Jul-09 8:09
ham_tim_hieu15-Jul-09 8:09 
GeneralRe: How can patch .NET assembly code Pin
ham_tim_hieu16-Jul-09 16:24
ham_tim_hieu16-Jul-09 16:24 
GeneralRe: How can patch .NET assembly code Pin
harold aptroot16-Jul-09 16:33
harold aptroot16-Jul-09 16:33 
GeneralRe: How can patch .NET assembly code Pin
ham_tim_hieu16-Jul-09 17:06
ham_tim_hieu16-Jul-09 17:06 
GeneralRe: How can patch .NET assembly code [modified] Pin
harold aptroot16-Jul-09 17:56
harold aptroot16-Jul-09 17:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.