🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #10317

Re: A Question about the CreateProcess API

#10317
From: Remy Lebeau (TeamB)
Date: Fri, 23 Apr 2004 18:17
53 lines
3013 bytes
"Carmen Guo" <carmen-g@oconnor-associates.com> wrote in message
news:40894f9e$1@newsgroups.borland.com...

>     This works well except for one scenario: if the user already has a
> file open in Word, when he double clicks on another Word file, the
> second file will open up in a new Word window. In other words, I
> have 2 Word applications running.

As well it should, since you started a new instance of the program.

> This is the case for Excel and CorelDraw files too. But for
> PowerPoint and CorelPhotoPaint files, the second file always
> opens up in the same window, i.e., 2 documents in the same
> application.

Those programs are obviously designed to only support 1 instance of
themselves running at any given time.  That is something that has to be
coded explitically on a per-application basis.

> My program just calls CreateProcss for each request when
> the user double clicks a file.  But it seems that for Word, Excel
> & CorelDraw, CreateProcess creates individual applications

CreateProcess() always creates a new process regardless of any other process
of the same program already running.

> whereas for PowerPoint and CorelPhotoPaint, Windows
> checks if an application is already open, and if yes, it just
> opens the document in the existing application.

No, Windows itself is not doing that at all.  The applications themselves
have to be specifically coded to detect another instance of themselves
already running, and if detected then to send the new file to the existing
instance instead of opening it in the newly created process.

>     So the question is: How can I make Word, Excel, and
> CorelDraw to behave in the same way?

You have no control over that, and you can't force it to work manually.  If
a program is not specifically designed to already support single instancing
of itself when opening multiple files, then it is out of your hands.

>     Does it have anything to do with the Windows  registry

No.

> or is it just characteristic of each individual application?

Yes.


Gambit
Technical Details
Message-ID: <40895f3c$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <40894f9e$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,500bb0aa1065a825
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2004-04-23 11:40:17 PST
From: "Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <40894f9e$1@newsgroups.borland.com>
Subject: Re: A Question about the CreateProcess API
Date: Fri, 23 Apr 2004 11:17:42 -0700
Lines: 55
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 67.22.138.253
Message-ID: <40895f3c$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1082744636 67.22.138.253 (23 Apr 2004 11:23:56 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail