Board index » cppbuilder » VCL component for registering file types.

VCL component for registering file types.


2008-02-29 09:16:41 AM
cppbuilder52
Is there a VCL component, or something else in Borland's component library,
that simplifies dealing with data in HKEY_CLASSES_ROOT -- specifically:
registering file types and also querying info about existing file type
associations?
Thanks,
Jason
 
 

Re:VCL component for registering file types.

"Jason Cipriani" < XXXX@XXXXX.COM >wrote in message
Quote
Is there a VCL component ... that simplifies dealing with data in
HKEY_CLASSES_ROOT -- specifically: registering file types
and also querying info about existing file type associations?
I have developed a free component for exactly that purpose:
TRegExtension
reg.lebeausoftware.org
Quote
or something else in Borland's component library
Borland does not have any native VCL components for managing file
extensions.
The Win32 API has an IQueryAssociations interface for querying (but not
assigning) the more common settings, but does not provide access to many of
the more advanced settings.
Gambit
 

Re:VCL component for registering file types.

Quote
I have developed a free component for exactly that purpose:

TRegExtension
reg.lebeausoftware.org

Gambit


Hi Remy,
Is it possible to use this component in BDS2006?
If so, how would I go about it?
Thanks,
David
 

{smallsort}

Re:VCL component for registering file types.

Remy wrote:
Quote
>I have developed a free component for exactly that purpose:
>
>TRegExtension
>reg.lebeausoftware.org
Nice, works like a charm! Thanks. The BCB6 version compiles and runs fine on
2007. Two small things:
1) When you use the Add() that takes a TExtInfo*, is this right:
TExtInfo *xi = new TExtInfo(".test1", Application->ExeName, "Test 1",
0);
RX->Add(xi);
RX->Register();
That seems to work OK (RX is the TRegExtension) -- except if I delete xi,
then an access violation occurs in TExtCommands::Clear when my program
exits. Looking at TExtCommand::Clear(), it appears that I should not delete
xi since Clear() deletes all the TExtInfo's I've Add()ed. Is this a general
behavior of "collections" -- if you add an item it takes "ownership" of it,
then if you Clear() the collection it deletes all your objects? Mostly I'm
just wondering; for when I write components in the future, to stick to
normal expected behaviors.
2) The docs for "TExtInfo::Extension" property say it adds a leading dot if
you don't put one in. On the other hand, specifying an extension to
TRegExtension::Add or the TExtInfo constructor does not seem to add a
leading dot if one is missing. Just to let you know.
"David Ayre" < XXXX@XXXXX.COM >wrote in message
Quote
Is it possible to use this component in BDS2006?
If so, how would I go about it?
Download the one marked TRegExtension v2.0.0.4 (BCB6), the build and install
it. It works for 2007, too.
Thanks,
Jason
 

Re:VCL component for registering file types.

Quote
>Is it possible to use this component in BDS2006?
>If so, how would I go about it?

Download the one marked TRegExtension v2.0.0.4 (BCB6), the build and install
it. It works for 2007, too.

Thanks,
Jason

Thanks Jason,
I can build it but I'm not sure how to install it. Could you advise, please.
Thanks,
David
 

Re:VCL component for registering file types.

"Jason Cipriani" < XXXX@XXXXX.COM >wrote in message
Quote
1) When you use the Add() that takes a TExtInfo*, is this right:

TExtInfo *xi = new TExtInfo(".test1", Application->ExeName, "Test 1",
0);
RX->Add(xi);
Although technically that will work, I would suggest using the other
overloaded versions of Add() instead, ie:
RX->Add(".test1", Application->ExeName, "Test 1", 0);
Quote
if I delete xi
Don't do that. TRegExtension owns the TExtInfo and will manage its lifetime
for you.
Quote
then an access violation occurs in TExtCommands::Clear when my program
exits.
Because it is trying to free an object that you already freed.
Quote
Looking at TExtCommand::Clear(), it appears that I should not delete xi
since Clear() deletes all the TExtInfo's I've Add()ed.
Correct.
Quote
Is this a general behavior of "collections" -- if you add an item it takes
"ownership"
of it then if you Clear() the collection it deletes all your objects?
Usually, yes.
Quote
2) The docs for "TExtInfo::Extension" property say it adds a leading dot
if you don't put one in.
Then the documentation is wrong, because the Extension property does not
actually do that. In the new version I am working on, it does do it,
though. So, in the meantime, just make sure to always include a leading dot
in your extension string values.
Quote
On the other hand, specifying an extension to TRegExtension::Add or the
TExtInfo constructor does not seem to add a leading dot if one is missing.
All Add() does is calls the TExtInfo constructor, which in turn assigns the
Extension property via the same setter as if you had assigned it manually.
Gambit
 

Re:VCL component for registering file types.

"David Ayre" < XXXX@XXXXX.COM >wrote in message
Quote
I can build it but I'm not sure how to install it. Could you advise,
please.
The same way you install any other component - load the BPK project into the
IDE, build it, and then use the Project Manager's "Install" option.
Gambit
 

Re:VCL component for registering file types.

Quote
The same way you install any other component - load the BPK project into the
IDE, build it, and then use the Project Manager's "Install" option.


Gambit


Thanks Remy,
I'd forgotten where to find the 'Install'. Found it now. Just
one of the trials of old age.
Cheers,
David
 

Re:VCL component for registering file types.

You should be able to load the project, then right-click on the BPL file in
the project manager and "install".
Alternatively, if you normally keep your package BPL, BPI, LIB, and header
files in some other location, just build it, don't install it, then copy the
BPL, BPI, and LIB files from the project directory to wherever you want
them, and copy RegExtensions.h to an appropriate location, too. Then you can
install the package by choosing "Install Packages" from the "Component" menu
and browsing to the files.
Jason
"David Ayre" < XXXX@XXXXX.COM >wrote in message
Quote


>>Is it possible to use this component in BDS2006?
>>If so, how would I go about it?
>
>Download the one marked TRegExtension v2.0.0.4 (BCB6), the build and
>install
>it. It works for 2007, too.
>
>Thanks,
>Jason
>

Thanks Jason,

I can build it but I'm not sure how to install it. Could you advise,
please.

Thanks,

David

 

Re:VCL component for registering file types.

Thanks!
"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
Quote

"Jason Cipriani" < XXXX@XXXXX.COM >wrote in message
news:47c9e31a$ XXXX@XXXXX.COM ...

>1) When you use the Add() that takes a TExtInfo*, is this right:
>
>TExtInfo *xi = new TExtInfo(".test1", Application->ExeName, "Test 1",
>0);
>RX->Add(xi);

Although technically that will work, I would suggest using the other
overloaded versions of Add() instead, ie:

RX->Add(".test1", Application->ExeName, "Test 1", 0);

>if I delete xi

Don't do that. TRegExtension owns the TExtInfo and will manage its
lifetime for you.

>then an access violation occurs in TExtCommands::Clear when my program
>exits.

Because it is trying to free an object that you already freed.

>Looking at TExtCommand::Clear(), it appears that I should not delete xi
>since Clear() deletes all the TExtInfo's I've Add()ed.

Correct.

>Is this a general behavior of "collections" -- if you add an item it
>takes "ownership"
>of it then if you Clear() the collection it deletes all your objects?

Usually, yes.

>2) The docs for "TExtInfo::Extension" property say it adds a leading dot
>if you don't put one in.

Then the documentation is wrong, because the Extension property does not
actually do that. In the new version I am working on, it does do it,
though. So, in the meantime, just make sure to always include a leading
dot in your extension string values.

>On the other hand, specifying an extension to TRegExtension::Add or the
>TExtInfo constructor does not seem to add a leading dot if one is
>missing.

All Add() does is calls the TExtInfo constructor, which in turn assigns
the Extension property via the same setter as if you had assigned it
manually.


Gambit