Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in WindowsApplication1.exe

 

Additional information: COM object with CLSID {3955D421-C8F3-11D2-B7C8-A22B3D95F811} is either not valid or not registered.

 

I'm trying to get file properties.

 

I first got this type of error using the Wordperfect Application .dll.

 

This error was from a .dll from microsoft for reading file properties.

 

Here's my code I used:

 

Private oFilePropReader As DSOleFile.PropertyReader

   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
       oFilePropReader = New DSOleFile.PropertyReader
       Label1.Text = oFilePropReader.GetDocumentProperties("C:\Source Code\DirMap.exe").Name
       TextBox1.Text = oFilePropReader.GetDocumentProperties("C:\Source Code\DirMap.exe").Keywords()

   End Sub

 

Is there something wrong with the code? Is there a reason why .net won't accept those two .dlls, but it does accept others?

 

If this won't work, is there another way to get a files attributes like: Author and keyword?

  • *Experts*
Posted

It looks like the DLLs are not registered, use the RegSrv32 tool. Put your DLLs in System32 dir and go to command prompt. Type in:

regsrv32 dllname

That should help you.

Posted

Well, that did something. I had the .dll added to my project as a resource before. Now I copied it to system32 and registered it.

 

Now I get this error:

 

An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in WindowsApplication1.exe

 

Additional information: The file you have selected is not an OLE document.

 

I find the last part ironic, how it says its not an OLE document, because it actually says it is and its a download from microsoft.

 

Any insight on this other error?

 

Thank you for your help :)

Posted

I havn't been able to figure out how to read or write to the name, author, subject, category, keywords or comments in vb.net.

 

If its in there somewere, I'd be more than happy to to learn how to do it in .net, any suggestions?

  • *Gurus*
Posted
I downloaded the component in question and the exception being thrown on your end occurs when a non-OLE document (e.g. a non-Microsoft Office document) is opened. The component is working fine for you, but you're attempting to pass in a path to an executable, which this library can not handle.
Posted

It said it was Office in general, and everything in 2k and xp.

 

I honestly don't know why .net or vb in general seems defunt in being able to bring up the properties of a windows file, which has been a standard part of the windows OS since at least win95, if not windows 3.1.

 

I've been trying to use this .dll with word documents, .wpd documents and others.

 

.wpd, wordperfect documents, are by far the more important since the documents I need to catagorize are in wordperfect format.

 

The other .dll I couldn't get to work with .net was the wordperfect automation dll. I wonder if I can use the same sort of 'get properties' commands that you can get with ms word.

 

well thank you for your help

Posted

I'm attempting to use the .dll with a msword document and ms excel, it works with their name property, though much slower than .nets io.file properties. It doesn't work with "Keyword" or "Author".

 

An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in WindowsApplication1.exe

 

Additional information: The file is currently open and cannot be read.

 

After the second part, I thought the file or an instance of word/excel might somehow be open. I rebooted and on a cleen reboot I still got the error. Only on trying to pull up part of the Summary, not the .name method.

  • *Experts*
Posted

The FileInfo Class allows you to create new instances for individual files and then access that instantiated FileInfo objects many properties that permit us to retrieve all sorts of useful infromation about the file in question.

 

The code below shows how to use the FileInfo class to get information about a file called Text.txt in the root directory of the C drive.

 

 

Imports System.IO


      Dim sFileName As String = "C:\Text.txt"
       Dim sFileData As String

       Dim fInfo As FileInfo = New FileInfo(sFileName)

       With fInfo
           sFileData += "Creation Time: " & .CreationTime.ToLongTimeString & Environment.NewLine()
           sFileData += "File Directory: " & .Directory.ToString & Environment.NewLine()
           sFileData += "Full Name: " & .FullName & Environment.NewLine()
           sFileData += "File Size (bytes): " & .Length.ToString & Environment.NewLine()

       End With

       MessageBox.Show(sFileData, "FileInfo Methods", MessageBoxButtons.OK, MessageBoxIcon.Information)

 

 

You should be able to use this without a call to any dll if all you're looking for is info about the file.

 

Jon

Posted

Yeah, fileInfo was the first thing I tried. I figured Microsoft would have to put the summary info in there, thats where it belongs.

 

I'd seriously love it if FileInfo can read the author or keyword from the summary page of a files properties.

 

My heard skipped a beat at a solution so simple... then I saw you wern't geting any of those values, just the standard ones.

 

If this method can get/write to the Keyword, Author or Description fields then I'm in luck, but I havn't found out how to do that.

Posted

It looks perfect... If I was able to use MS Office for everything at work. 90% of the office uses Wordperfect.

 

I already posed the idea of them all choosing "Save As..." and selecting "Microsoft Word .Doc".

 

Wordperfect is a crappy wordproccesser compared to word, but its about 99% cheaper (for the price of 1 copy of MS office we got a liscence to run Corell office for the entire buisiness, unlimited machines) and has far superior conversion capabilities.

 

In theory if everyone wern't so damn lazy, they could just save as a word document and wordperfect opens word documents.

 

In fact, since 90% of our policies and statements are in wordperfect, even those who use MS Office have to have Corell Office on their machines because Word can't read Wordperfect.

 

The big stumbling point here is that apparently Corell offices 2002 Suite doesn't have Application Automation .DLL's compatable with .net.

 

I might have to whip out vb6 for this project, which is a shame because it takes 5x as long for vb6 to just scan the directories than it takes .net.

 

EVERYTHING has a Summary page... EXE's, WPD, DOC, TXT, COM, BAT, etc Everything. I don't see why if Windows can access it when you click properties, there isn't some function for it as an API or in VB...

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...