Property Handler

I'm trying to use the Windows API Code Pack 1.1 to write extended attributes to files of type .pcap. Here's the code I'm using:

private void SetExtendedAttributes(string sFilePath)
{
	try
	{
		ShellObject file = ShellObject.FromParsingName(sFilePath);
		ShellPropertyWriter writer = file.Properties.GetPropertyWriter();
		writer.WriteProperty(SystemProperties.System.Author, "me myself I");

		// Closing the writer actually commits the changes.
		writer.Close();
	}
	catch
	{
	}
}

Open in new window


The program errors on the line: ShellPropertyWriter writer = file.Properties.GetPropertyWriter()

with the error:

-		$exception	{"Unable to get writable property store for this property."}	System.Exception {Microsoft.WindowsAPICodePack.Shell.PropertySystem.PropertySystemException}

+		InnerException	{"Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))"}	System.Exception {System.Runtime.InteropServices.COMException}


So I dug around and I believe that the .pcap file extension doesn't have a Property Handler. If I use a .jpg or .docx file then the code works fine. So my question is, how do I create a Property Handler for .pcap files? I'd like to use C# .Net in VS2010. Can you help?
goondoo27Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Daniel Van Der WerkenIndependent ConsultantCommented:
Looks like there is no property handler registered for the .PCAP file extension.  Generally the developer creating and using this extension should create the property handler.  If not, then perhaps you need to write one for this then.  

Here is a link that should provide you with information regarding writing a handler:  http://msdn.microsoft.com/en-us/library/windows/desktop/cc144129%28v=vs.85%29.aspx
0
goondoo27Author Commented:
Dan7el, thanks for the comment. I've read that web page, but it's still too complicated for me. I'm looking for an actual example that I can modify, or some simple steps to create the property handler. I tried following the MSDN instructions, but got no where.
0
LeeTutorretiredCommented:
I've requested that this question be deleted for the following reason:

This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
Acronis Data Cloud 7.8 Enhances Cyber Protection

A closer look at five essential enhancements that benefit end-users and help MSPs take their cloud data protection business further.

goondoo27Author Commented:
I'd still like to get an example of a Property Handler that can be written for a specific extension. In my case I trying to get a Property Handler for a .pcap file. Can nobody out there help me? I've read tons of documentation and am left still wondering how to do it.
0
David Johnson, CD, MVPOwnerCommented:
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
goondoo27Author Commented:
Thanks ve3ofa! I'm working on the code now. I'll keep you posted on whether I get it working or not.
0
goondoo27Author Commented:
I'm still making changes to the example code you provided, but since you've fulfilled my request I thought I'd close this issue.

Thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.