🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: CmdLine ParamStr and Folder Shell command parameters

#9204
From: Ian Robertson
Date: Sat, 24 Jul 2004 14:31
57 lines
2967 bytes
> it should be ParamStr(2)...

Thank you for your suggestion, I tried that previsouly - ParamStr(2) is NULL
ParamCount() = 1, so there is only 1 ParamStr to worry about - Im still
stuck


Snippet:

AnsiString CommandLine = CmdLine;

if (AnsiContainsStr(CommandLine,".mpd"))    // if someone opens database
file in explorer by double clicking it, open database file (.mpd) with app
{
CommandLine = ExtractFileName(CommandLine).c_str();
CommandLine.Delete(CommandLine.Length(),1);

ADOConnection1->ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;User
ID=Admin;Data Source=" + CommandLine + ";Mode=Share Deny None;Extended
Properties="";Jet OLEDB:System database="";Jet OLEDB:Registry Path="";Jet
OLEDB:Database Password="";Jet OLEDB:Engine Type=5;Jet OLEDB:Database
Locking Mode=1;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk
Transactions=1;Jet OLEDB:New Database Password="";Jet OLEDB:Create System
Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don't Copy Locale
on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet
OLEDB:SFP=False";

ADOConnection1->Connected = true;
DBGrid1->DataSource->DataSet->Active = true;
DBGrid1->Visible = true;
DBNavigator1->Visible = true;

// this works perfectly

}
else
{
// reg entry = "G:\Project\ADO Database\MP3 Catalogue
v1.0\MP3_Catalogue.exe" "%1"
int lineargs = ParamCount();
Application->MessageBox((ParamStr(2)+ "
"+IntToStr(lineargs)).c_str(),"Message",MB_OK);
// this doesnt work
}

I need help with the else part. I tried using another "if" statement:

if (AnsiContainsStr(CommandLine,"%1"))

to determine if the program was launched from the Folder's shell command,
but the %1 doesnt pass properly - I thought %1 was used by the shell API to
pass the folder name?

If anyone can see anything wrong with the reg entry or can help with the
second else/if statement to respond to the program being launced by the
Folder's shell command that would be a great help.
Technical Details
Message-ID: <410272c8$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <410229eb$1@newsgroups.borland.com> <41024118@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,69b2a3e1b54fedf3
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Ian Robertson" <ian.robertson@zoom.co.uk>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <410229eb$1@newsgroups.borland.com> <41024118@newsgroups.borland.com>
Subject: Re: CmdLine ParamStr and Folder Shell command parameters
Date: Sat, 24 Jul 2004 15:31:35 +0100
Lines: 63
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
NNTP-Posting-Host: 82.2.134.233
Message-ID: <410272c8$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1090679496 82.2.134.233 (24 Jul 2004 07:31:36 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail