🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: CmdLine ParamStr and Folder Shell command parameters

#9205
From: Bob Gonder
Date: Sat, 24 Jul 2004 15:45
42 lines
2246 bytes
Ian Robertson wrote:

>
>My program creates the following registy entries:
>
>Folder
>  Shell
>    command
>(default) String value = "C:\app.exe" "%1"

I think you missed a line there
	Folder
		Shell
			ContextMenuName
				command
					reg_expand_sz

>Can anyone help me get the folder name instead of the path of my exe? I thought the %1 is supposed to pass the path of the folder clicked, not my exe.

Command Prompt Here uses %1
PSP uses %L
Open and Explore both use %i and %L


>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?

Well, yeah, but by the time you get it, it's the folder name, not %1.

Other problem with your code:

>if (AnsiContainsStr(CommandLine,".mpd"))    // if someone opens database

Suppose I have a folder named "MyData.mpd"?
What if the file is  .MPD ?

You are probably better off taking whatever filename is passed to you,
and running it through something like FindFirstFile and checking the
attributes to see if it is a file or a directory. Then, if it is a
file, validate that it is a db file.
Technical Details
Message-ID: <iqv4g05vsc1oo5mqgcg3bb2o97cu89vsc2@4ax.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>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,69b2a3e1b54fedf3
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: Bob Gonder <notbg@notmindspring.invalid>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: CmdLine ParamStr and Folder Shell command parameters
Date: Sat, 24 Jul 2004 08:45:14 -0700
Organization: MindSpring Enterprises, Inc.
Reply-To: notbg@notmindspring.invalid
Message-ID: <iqv4g05vsc1oo5mqgcg3bb2o97cu89vsc2@4ax.com>
References: <410229eb$1@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.93/32.576 English (American)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 69.34.96.208
X-Trace: newsgroups.borland.com 1090683912 69.34.96.208 (24 Jul 2004 08:45:12 -0700)
Lines: 47
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