Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Application Recognizing Registered File Double Clicked

0 views
Skip to first unread message

Chris

unread,
Oct 16, 2003, 12:20:07 PM10/16/03
to
Hi Everyone,


First I hope I am posting this is the correct group, if I'm not I
apologize for any inconvenience and hope someone can point me in the
right direction.

What I have is a file extension which has been registered in the
Registry, and when I double click the file with that particular
extension my application is started. This part is working fine,
however, there are 2 important pieces of data that I need from the
file double clicked. Right my application is started, then the user
needs to go to file open and select the file. Is there a way for my
application to recognize that a file with a registered extension has
been double clicked? Also, if this is possible, is the file and path
that was double clicked sent to my application?

If this doesn't make any sense please post any questions and I will
try to elaborate as best I can on what I am trying to ask above.
Thanks everyone and any response is greatly appreciated!


Regards,


CLR

Chris

unread,
Oct 16, 2003, 8:30:18 PM10/16/03
to
I forgot to add that I am using Borland C++ v6.0...

Thanks!

ch...@dagran.com (Chris) wrote in message news:<736fadb1.03101...@posting.google.com>...

Raymond Chen

unread,
Oct 16, 2003, 11:54:47 PM10/16/03
to
On 16 Oct 2003 09:20:07 -0700, ch...@dagran.com (Chris) wrote:
>Also, if this is possible, is the file and path
>that was double clicked sent to my application?

http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/programmersguide/shell_basics/shell_basics_extending/fileassociations/fa_verbs.asp

(sorry that's a really long URL. Or you can google for "Verbs and
File Associations".)

Use %1 to specify where the filename should go.

Elias Fotinis

unread,
Oct 16, 2003, 7:47:07 PM10/16/03
to
Chris wrote:
> What I have is a file extension which has been registered in the
> Registry, and when I double click the file with that particular
> extension my application is started. This part is working fine,
> however, there are 2 important pieces of data that I need from the
> file double clicked. Right my application is started, then the user
> needs to go to file open and select the file. Is there a way for my
> application to recognize that a file with a registered extension has
> been double clicked? Also, if this is possible, is the file and path
> that was double clicked sent to my application?

You can add "%1" at the end of the shell open command of your registered
extension. This will make your program start with the full name and path
of the file double-clicked at its command line. You can get the command
line from WinMain's parameter, or use GetCommandLine() later.

For example:

HKCR\YourFileClass\shell\open\command
@="C:\...\YourProgram.exe" %1

Note, however, that this will cause your application to start a new
instance for every file clicked. If you want all files to be opened on
the same window (e.g. an MDI interface), you either have to use DDE or
some sort of IPC to inform the previous instance of the new file.

Raymond Chen

unread,
Oct 17, 2003, 11:43:51 PM10/17/03
to
On Fri, 17 Oct 2003 02:47:07 +0300, "Elias Fotinis"
<efoti...@SPAMpat.forthnet.gr> wrote:
>For example:
>
> HKCR\YourFileClass\shell\open\command
> @="C:\...\YourProgram.exe" %1

You probably should put quotation marks around the "%1" so your
program will handle files which have spaces in the name.

Chris

unread,
Oct 27, 2003, 1:18:18 PM10/27/03
to
Thanks Everyone! I have my program doing exactly what I want!

Regards!

ch...@dagran.com (Chris) wrote in message news:<736fadb1.03101...@posting.google.com>...

0 new messages