🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: IE and .xml files

#13466
From: Remy Lebeau (TeamB)
Date: Thu, 09 Oct 2003 17:27
54 lines
3275 bytes
"Mike Shultz" <no@where.com> wrote in message
news:3f856f91@newsgroups.borland.com...

>     I've written my app for verifying signature of XML files (XML
Signature).
> I'd like when user double click .xml file, it opens in my app, BUT only if
.xml
> file contains <Signature> tag. If not, then .xml file should be opened in
user's
> default app for .xml files (IE or XML Spy...). Is it possible? How? Any
tips?

When a user double-clicks on a file, only one operation can occur.  A file
extension (.xml in this case) can only have a single default action for
double-clicking.  What you are asking for would require you to change the
file extension's information in the Registry to always load your app
regardless, then you can parse the XML and if needed, spawn the other
application yourself manually.  Otherwise, don't invoke your application by
default at all, but instead provide a separate option that the user can
right-click on the .xml file and choose your option instead of opening the
file normally.  There are two ways you can do that:

1) Add a "verify" verb (or whatever you want to name it) to the available
shell commands for an .xml file:

    HKEY_CLASSES_ROOT\.xml
    "(Default)"="xmlfile"

    HKEY_CLASSES_ROOT\xmlfile\shell\verifysig
    "(Default)="&Verify Signature"

    HKEY_CLASSES_ROOT\xmlfile\shell\verifysig\command
    "(Default)"="c:\path to\myprogram.exe "%1""

    When the user right-clicks on an .xml file, they will see a "Verify
Signature" option that will invoke your program, and then existing "Open"
option will remain uneffected.


2) the above approach adds a "Verify Signature" option to the file's context
menu regardless of whether a signature is actually present or not.  If you
only want the option to appear when a signature is really available, then
you would need to create a Shell Context Menu Handler instead, so that
whenever the context menu is invoked, you can actually open the particular
file and examine its contents before deciding whether to add the new option
or not for that particular file, on a file-by-file basis.  Have a look at
the following article for more information on Context Menu Handlers:

    Creating Context Menu Handlers
    http://tinyurl.com/lts5


Gambit
Technical Details
Message-ID: <3f859a2c@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!news-out.visi.com!petbe.visi.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3f856f91@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,78a23c5c0f94af79
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-10-09 11:30:42 PST
From: "Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3f856f91@newsgroups.borland.com>
Subject: Re: IE and .xml files
Date: Thu, 9 Oct 2003 10:27:24 -0700
Lines: 56
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 67.22.137.75
Message-ID: <3f859a2c@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1065720364 67.22.137.75 (9 Oct 2003 10:26:04 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!news-out.visi.com!petbe.visi.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail