🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: shellExecute and Notepad wierdness..

#6300
From: Roddy Pratt
Date: Tue, 24 May 2005 16:53
58 lines
2672 bytes
While that wasn't what exactly I wanted to do, it did show me the answer - 
Thanks!

SW_SHOW is needed as the last param, despite the BCB online help stating "If 
lpFile specifies a document file, nShowCmd should be zero."

This param is passed to the application - many ignore it,or accept zero - 
but NOT notepad.

 - Roddy

"Ali" <ali_info@hotpop.com> wrote in message 
news:42931759@newsgroups.borland.com...
>   AnsiString MyStr;
>     MyStr="NOTEPAD.EXE";
>     ShellExecute(NULL,
>                         NULL,
>                         MyStr.c_str(),
>                         NULL,
>                         NULL,
>                         SW_SHOW
>                        );
>
> ----------------------------------------
> "Roddy Pratt" <roddy at spam fritter dot com> wrote in message
> news:4292fa85$1@newsgroups.borland.com...
>> I'm using ShellExecute to open a document specified by the user, from 
>> BCB5
>> on XP SP2
>>
>> It works fine for most file types (eg spreadsheets, PDFs) and URLs.
>>
>> But, when I try it with a .txt file, 'nothing obvious happens'.
> ShellExecute
>> returns 42 which is not an error code.
>>
>> When I check in the task manager, there's a now a notepad.exe *process*
>> shown, but NOT a notepad application!
>>
>> .txt files open fine with notepad from the desktop, either by
> doubleclicking
>> or selecting 'open'.
>>
>> I'm confused!
>>
>>  - Roddy
>>
>>
>>   int err = (int)
>> ShellExecute(Application->MainForm->Handle,"open",docname.c_str(),(params
> ==
>> "")? NULL:params.c_str(), NULL,0);
>>   if (err <= 32)
>>     ...
>>
>>
>
> 
Technical Details
Message-ID: <42935c0e@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!213.239.142.2.MISMATCH!feeder.xsnews.nl!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <4292fa85$1@newsgroups.borland.com> <42931759@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,ca680fb605a9512
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Roddy Pratt" <roddy at spam fritter dot com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <4292fa85$1@newsgroups.borland.com> <42931759@newsgroups.borland.com>
Subject: Re: shellExecute and Notepad wierdness..
Date: Tue, 24 May 2005 17:53:36 +0100
Lines: 60
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 82.70.221.38
Message-ID: <42935c0e@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1116953614 82.70.221.38 (24 May 2005 09:53:34 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!213.239.142.2.MISMATCH!feeder.xsnews.nl!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail