Can anyone help me out on this error?

Denaes

Well-known member
Joined
Jun 10, 2003
Messages
956
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.

Im 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.

Heres my code I used:

Code:
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 wont accept those two .dlls, but it does accept others?

If this wont work, is there another way to get a files attributes like: Author and keyword?
 
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:
Code:
regsrv32 dllname
That should help you.
 
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 :)
 
Unless that library performs something unique you can most likely achieve whatever youre trying to accomplish with [msdn]System.IO.File[/msdn] instead.
 
I havnt 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, Id be more than happy to to learn how to do it in .net, any suggestions?
 
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 youre attempting to pass in a path to an executable, which this library can not handle.
 
It said it was Office in general, and everything in 2k and xp.

I honestly dont 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.

Ive 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 couldnt 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
 
Im 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 doesnt 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.
 
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.


Code:
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 youre looking for is info about the file.

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

Id 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 wernt geting any of those values, just the standard ones.

If this method can get/write to the Keyword, Author or Description fields then Im in luck, but I havnt found out how to do that.
 
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 wernt 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 cant read Wordperfect.

The big stumbling point here is that apparently Corell offices 2002 Suite doesnt have Application Automation .DLLs 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... EXEs, WPD, DOC, TXT, COM, BAT, etc Everything. I dont see why if Windows can access it when you click properties, there isnt some function for it as an API or in VB...
 
Back
Top