🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: URL Offsets Prevent URLs from being passed to a browser

#9139
From: Randall Parker
Date: Wed, 28 Jul 2004 02:55
37 lines
2330 bytes
My solution:

    AnsiString HelpDirStr = ExtractFilePath(Application->ExeName) + "Help/";
    AnsiString UrlStr = "file://" + ExtractFilePath(Application->ExeName) + 
"Help/1_Introduction.htm";
    AnsiString Param = UrlStr+"#HotKeys";
    char BrowserExePath[512] = "";
    FindExecutable("1_Introduction.htm", HelpDirStr.c_str(), BrowserExePath);
    if ((strlen(BrowserExePath) > 0))
    {
       ShellExecute(NULL,"open",BrowserExePath,Param.c_str(),0,SW_SHOWDEFAULT);
    }

Randall Parker wrote:
> Suppose I have
> 
>    AnsiString UrlStr = "file://" + ExtractFilePath(Application->ExeName) 
> + "myfile.htm";
>    ShellExecute(NULL,"open",UrlStr.c_str(),0,0,SW_SHOWDEFAULT);
> 
> That works. But if I have:
> 
>    AnsiString UrlStr = "file://" + ExtractFilePath(Application->ExeName) 
> + "myfile.htm#HotKeys";
>    ShellExecute(NULL,"open",UrlStr.c_str(),0,0,SW_SHOWDEFAULT);
> 
> or:
> 
>    AnsiString UrlStr = "file://" + ExtractFilePath(Application->ExeName) 
> + "myfile.htm%23HotKeys";
>    ShellExecute(NULL,"open",UrlStr.c_str(),0,0,SW_SHOWDEFAULT);
> 
> then the browser (Mozilla FireFox) doesn't get invoked.
> 
> I suspect the #Hotkeys or the %23HotKeys is preventing the file from 
> being recognized as appropriate for a browser. How to route the shell 
> execution call to the browser?
Technical Details
Message-ID: <4107159b$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.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: <41048d77$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,80cfdee9a8d50af3
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Tue, 27 Jul 2004 19:55:41 -0700
From: Randall Parker <STOPtechiepundit@EVILfuturePOXpunditSPAM.com>
User-Agent: Mozilla Thunderbird 0.7 (Windows/20040616)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: URL Offsets Prevent URLs from being passed to a browser
References: <41048d77$1@newsgroups.borland.com>
In-Reply-To: <41048d77$1@newsgroups.borland.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 4.40.49.194
Message-ID: <4107159b$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1090983323 4.40.49.194 (27 Jul 2004 19:55:23 -0700)
Lines: 37
Path: arc1-ca.pugleaf.net!g2news1.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