By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,515 Members | 1,061 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,515 IT Pros & Developers. It's quick & easy.

Interop prob

P: n/a
I am writing a function in VB.Net which opens a WordPerfect document,
searches for a particular STYLE and returns the innertext in the
STYLE.

Dim oWP As New WordPerfect.PerfectScript
oWP.FileOpen "C:\temp\test.wpd", WordPerfect_90_FileOpen_Format
With oWP
.StyleEditBegin "STYLENAME"
.StyleCodes WithoutOffCodes_StyleCodes_State
.SelectAll
MsgBox oWP.envSelectedText
.StyleEditEnd (Cancel_StyleEditEnd_State)
End With
oWP.Quit

Code works fine functionally both in VB6 and VB.Net.

My usecase is when the code throws an error (Say the style STYLENAME
is not found), in VB6 a proper error code indicating the error is
returned with the exception details well documented. However in VB.Net
the same code returns an exception like:
"An unhandled exception of type
'System.Runtime.InteropServices.COMException' occurred in
mscorlib.dll"

I want to track the error code and handle the exception accordingly
while displaying the error message to the user, in .Net as well.

I have tried everything but the COM object doesnt return exception
details at all. After reading a few articles about
SetUnhandledExceptionFilter and thread, I guess, this is not a
WordPerfect specific problem but a more generic COM/.Net
interoperability problem.

Can someone pour shed some light on this plz. Thanks in advance.
Nov 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.