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?
 
David Johnson, CD, MVPOwnerCommented:
0
 
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
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
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
 
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
 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.