473,386 Members | 1,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Error with TreeView Control (MSCOMCTL.OCX) via COM Interop from ASP.NET and Service Pack

I have an ASP.NET (VB.NET) application that calls all VB6 COM DLL via
Interop. The DLL uses functionality contained in a Custom OCX Control
(Also VB6) that in turn contains a standard TreeView control. The
Custom OCX is not used for visual purposes, but has some functionality
that we require (hence hosting an OCX in a DLL).

Everything worked fine until we installed the latest service pack for
each respective windows operating system:
Windows 2003 Server - Service Pack 1
Windows XP - Service Pack 2
Windows 2000 Server - Service Pack 4

Now whenever our COM object attempts to load a form containing the
treeview control the COM object "dies" - by which I mean despite
error-trapping on the VB6 COM side, the application throws an exception
back on the ASP.NET side:

"Object reference not set to an instance of an object."

This occurs immediately after a successful call to the same COM
object, so it's not that the object or method or NULL.
It also appears the issue is happening outside of the error handling of
VB6 - i.e. after the Load(Object) call, but before any user-accessible
hook on the newly created form (extensive logging during debugging
shows the load is the last thing called).

This occurs on calling the Load operation of the form (either
explicitly with a Load(Object) call, or implicity by referencing a
property on the instantiated form); the instantiation of the object
containing the TreeView-hosting form is fine.

If I run my ASP.NET application under the context of the machine
Administrator account (via Impersonation) this still happens - testing
returns the security context from the VB6-side and it is Administrator
as well in this scenario. If I run a comparable VB.NET console
application (even under a less-privileged account than Admin) it works
fine.

STEPS TO REPRODUCE:
1. Create a VB6 DLL - add a form and drag a standard Microsoft TreeView
control onto the form. Name the form "frmTreeView".
2. Add a Class to your DLL with the following code:

Option Explicit
Private myForm As frmTreeView

Public Function StepOne() As String
On Error GoTo err1

Set myForm = New frmTreeView
StepOne = "StepOne Success"
Exit Function
err1:
StepOne = "Error in StepOne: " & Err.Number & ": " &
Err.Description
End Function

Public Function StepTwo() As String
On Error GoTo err2

Call Load(myForm)
StepTwo = "StepTwo Success"
Exit Function
err2:
StepTwo = "Error in StepTwo: " & Err.Number & ": " &
Err.Description
End Function

3. Compile and register your DLL

4. Create a simple ASP.NET application that has a COM-Interop reference
to the DLL. Add a page like:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Dim myTree As New pceWidget.clsPceTreeViewClass

Try
Response.Write("StepOne: " & myTree.StepOne & "<br />")
Response.Write("StepTwo : " & myTree.StepTwo & "<br />")
Catch ex As Exception
Response.Write("TreeView Exception: " & ex.StackTrace & " - " &
ex.Message & "<br />")
End Try

myTree = Nothing
End Sub

5. Run the application. If you are running an OS without the above
mentioned service packs it *should* work, but will fail under any of
the SP-scenarios above. I say *should* as there are potential
situations where a Microsoft HotFix (that is now rolled-up in the SP)
causes the same behaviour.

I figure it's a security issue, but nothing as simple as the security
context of the executing app - something more inline with threading
security changes or COM - also, everything is running on the same box
(no cross-machine boundaries).

Any help will be greatly appreciated!

Thanks,
Mark

Nov 19 '05 #1
0 2460

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Ike | last post by:
I have an Activex Control created in VB6, which, displays no problem on any machine I have, but, on some machines of others, it does not. All machines are running either XP or Windows 2000, and all...
6
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
4
by: What-a-Tool | last post by:
Is possible to use the windows image list for icon display in my treeview control? Would appreciate it you could point me towards a code sample or Key phrase to use in a google search. Thanks...
42
by: lauren quantrell | last post by:
So many postings on not to use the treeview control, but nothing recently. Is it safe to swim there yet with Access 2000-Access 2003?
5
by: andy.g.ward | last post by:
I keep getting this when trying to create an MFC activex control in a c# windows service - anyone got any ideas what the missing module could be??? Exception thrown :...
77
by: Tark Siala | last post by:
hi i working with TreeView in VB6, and have good Properity Named (Key) with the Key i can goto Any Node i know hes Key. but in VB.NET i can find the Key :( please tell me where i can find the...
3
by: Benny Raymond | last post by:
I get the following error message when trying to use the Excel Interop on my wife's machine however I don't get it on my own - we have the same version of Office installed - what could be the...
8
by: las | last post by:
(Originally posted to framework.aspnet.webservices, but I am casting a larger net and trying again) I am using a library supplied by a third-party vendor. Although the library has no UI, the...
4
by: hsonny | last post by:
Hi there, I have an ASP page using the treeview control from mscomctl.ocx that was running just fine. We updated our browsers with this package ( details at...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.