views:

75

answers:

0

Hi,

Update 1:

Further investigation reveals that VB Activex component failed to initialize the user32 dll and failed to invoke the ShowWindow method when the browser security trust level is medium.

Update 2:

I have fixed the issue by just enabling the allow scripting of the webbrowser control option in medium level security.

I dont understand how this attrubute affect the ActiveX invoke behaviour..? but this works..


I have a problem calling activex components in medium trusted security level (browser). For long time the application is working fine in the low trusted security level.

This is a Asp.net web application, and we have a VB activex component is been registered on the client machine to do certain tasks in legacy window systems. We have two simple native API calls within that VB component one is to hide the already opened window and show the hidden window.

For this, we have been using user32 ShowWindow && Findwindow API. like this

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpszClassName As String, ByVal lpszWindow As String) As Long

Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow  
As Long) As Long

Private Const SW_SHOW = 5
Private Const SW_HIDE = 0


Public Function Show(sWindowName As String) As String
    Dim handle As Long
    handle = FindWindow(vbNullString, sWindowName)
    ShowWindow handle, SW_SHOW
Exit Function
End Function

Public Function Hide(sWindowName As String) As String
    Dim handle As Long
    handle = FindWindow(vbNullString, sWindowName)
    ShowWindow handle, SW_HIDE
Exit Function
End Function

Problem:

In medium & hight security level, i can't show or hide the windows,.

It seems the problem is only with invoking this component from the medium & high security levels.

Questions:

  • Is there a way in VB Activex developmnet to bypass the secutiy levels (to make it work in all security zones).

  • what are the security guidelines i need to take care of when developing & deploying broswer based ActiveX controls??

Cheers

RameshVel