Discussion:
Advice needed for a situation
(too old to reply)
JoDeGr8
2009-09-19 11:10:05 UTC
Permalink
Hi,
I am developing a program which needs to read 'Author' property of
all the files in a directory. I am currently depending on
IPropertySetStorage to accomplish this task. This code will reside
inside a hook function and when user presses a special key, hook will
be invoked and scans all the files in a folder and gives user a
report. The hook function will requests a IPropertySetStorage for
every file it encounters and releases it after working with a file.

I wanted to know whether it is the right way for doing this.

Expert advice invited.

Thanks in advance,

Regards,
Joe
Tim Roberts
2009-09-20 00:50:11 UTC
Permalink
Post by JoDeGr8
I am developing a program which needs to read 'Author' property of
all the files in a directory. I am currently depending on
IPropertySetStorage to accomplish this task. This code will reside
inside a hook function and when user presses a special key, hook will
be invoked and scans all the files in a folder and gives user a
report. The hook function will requests a IPropertySetStorage for
every file it encounters and releases it after working with a file.
I wanted to know whether it is the right way for doing this.
Why make this a hook? You can make this a regular executable, and just
associate a hot key with it through Explorer, so that the program is run
when that key is pressed.

Most people are not aware of how much overhead is involved with hooking.
When you install a hook, your DLL gets injected into every process that
owns a window. When you detect an event, you will be running in a thread
in whatever process generated the event. That means you'll have to
initialze COM again in any thread. It also means you have special
considerations for allocating memory.

You do realize that IPropertySetStorage only works with files from
applications that store document properties, like the Office applications,
right?
--
Tim Roberts, ***@probo.com
Providenza & Boekelheide, Inc.
JoDeGr8
2009-09-20 07:57:08 UTC
Permalink
Hi,
Thanks,
Post by Tim Roberts
Why make this a hook? You can make this a regular executable, and just
associate a hot key with it through Explorer, so that the program is run
when that key is pressed.
Can u please explain further?
Post by Tim Roberts
You do realize that IPropertySetStorage only works with files from
applications that store document properties, like the Office applications,
right?
I need to get the properties of mp3 and image files as well. Is
there any other way to get the values from the property set of these
file types?

Regards,
Joe
Post by Tim Roberts
I am developing a program which needs to  read 'Author' property of
all the  files in a directory. I am currently depending on
IPropertySetStorage to accomplish this task. This code will reside
inside a hook function and when user presses a special key, hook will
be invoked and scans all the files in a folder and gives user a
report. The hook function will requests a IPropertySetStorage for
every file it encounters and releases it after working with a file.
I wanted to know whether it is the right way for doing this.
Why make this a hook?  You can make this a regular executable, and just
associate a hot key with it through Explorer, so that the program is run
when that key is pressed.
Most people are not aware of how much overhead is involved with hooking.
When you install a hook, your DLL gets injected into every process that
owns a window.  When you detect an event, you will be running in a thread
in whatever process generated the event.  That means you'll have to
initialze COM again in any thread.  It also means you have special
considerations for allocating memory.
You do realize that IPropertySetStorage only works with files from
applications that store document properties, like the Office applications,
right?
--
Providenza & Boekelheide, Inc.
Tim Roberts
2009-09-22 04:03:12 UTC
Permalink
Post by JoDeGr8
Post by Tim Roberts
Why make this a hook? You can make this a regular executable, and just
associate a hot key with it through Explorer, so that the program is run
when that key is pressed.
Can u please explain further?
Here's an example. Pick one of the links on your desktop. Right-click on
it and pick Properties. On the Shortcut page, you'll see a box for
"Shortcut Key". You can assign a keystroke combination to the shortcut.
Any time you press the key combination, your program will be launched.
Post by JoDeGr8
Post by Tim Roberts
You do realize that IPropertySetStorage only works with files from
applications that store document properties, like the Office applications,
right?
I need to get the properties of mp3 and image files as well. Is
there any other way to get the values from the property set of these
file types?
Not generically, no. You have to go read the MP3 and image files yourself.
You can find MP3 and JPEG libraries to help with that task. However, many
(most?) of those kinds of files don't have an "author".
--
Tim Roberts, ***@probo.com
Providenza & Boekelheide, Inc.
Loading...