🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: shellexecute

#4065
From: Ed Mulroy
Date: Sat, 25 Mar 2006 11:03
57 lines
3035 bytes
I don't think default directory should be NULL.  It might need to be 
".\\help" (don't overlook the leading period in that string).

The name of the file to execute is shown as "help//help.pdf".  Slashes are 
doubled in a string only if they are backslashes.  You used forward slashes, 
correct for some operating systems such as Linux or one of the Unixes but 
only begrudgingly accepted some places and not others by Windows.  Either 
use one forward slash or a doubled backslash.

The return value is not zero for failure except in the case of when the 
operating system has run out of memory or resources.  An error is indicated 
by a return value of 32 or less.  The code you show would not trigger the 
message box on error except when memory or resources are exhausted. 
Otherwise it would fail quietly, the exact behavior you report.

init result = (int) ::ShellExecute(
    0, "open", "help\\help.pdf", NULL,
    ".\\help", SW_SHOWNORMAL)

if (result <= 32)
    {
    Application->MessageBox(
     "You need Acrobat Reader for viewing help",
     "Information");
    }

.  Ed

> Tom wrote in message
> news:442507f8@newsgroups.borland.com...
>I have made a help file for my application in .pdf format. I use the 
>following command to open it on help button click:
>
> ShellExecute(0, "open", "help//help.pdf", NULL, NULL, SW_SHOWNORMAL)
>
>
> How do I know if that file has been opened, I tried with following:
>
> if (!ShellExecute(0, "open", "help//help.pdf", NULL, NULL, SW_SHOWNORMAL))
>   Application->MessageBox("You need Acrobat Reader for viewing 
> help","Information");
>
> but it doesn't work, also I've tried
>
> try
> {
> ShellExecute(0, "open", "help//pomoc.pde", NULL, NULL, SW_SHOWNORMAL))
> }
> catch(...)
> {
> Application->MessageBox("You need Acrobat Reader for viewing 
> help","Information");
> }
>
> it also doesn't work. I just want to know if end user opened the file, and 
> if he didn't I want to give him message to inform him that help is in 
> Acrobat Reader format and he needs to install it in order to read help.
Technical Details
Message-ID: <4425236a@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <442507f8@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,9f97f6e70caedf1b
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Ed Mulroy" <dont_email_me@bitbuc.ket>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <442507f8@newsgroups.borland.com>
Subject: Re: shellexecute 
Date: Sat, 25 Mar 2006 06:03:02 -0500
Lines: 59
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 66.57.117.102
Message-ID: <4425236a@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1143284586 66.57.117.102 (25 Mar 2006 03:03:06 -0700)
X-Authenticated-User: edmulroy
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail