Z
Zamdrist
Running an application executable (release) runs find on my computer:
"The application attempted to perform an operation not allowed by the
security policy."...
System.Security.SecurityException:
System.Security.Permissions.SecurityPermission...
Thoughts?
I was able to narrow the problem down the EnumWindows API call and
AddressOf Callback routine here:
Public Sub InitList()
Dim cb As CallBack
cb = New CallBack(AddressOf MyCallBack)
EnumWindows(cb, 0)
End Sub
Public Function MyCallBack(ByVal hwnd As IntPtr, ByVal lParam As
IntPtr) As Boolean
Dim intLen As Integer = GetWindowTextLength(hwnd) + 1
If intLen > 1 Then
Dim strText As New StringBuilder(intLen)
Try
GetWindowText(hwnd, strText, intLen)
If IsWindowEnabled(hwnd) And IsWindowVisible(hwnd) Then
lvWindows.Items.Add(strText.ToString).SubItems.Add(hwnd.ToString)
End If
Catch ex As Exception
Trace.WriteLine(ex.ToString)
End Try
End If
Return True
End Function
Public Delegate Function CallBack(ByVal hwnd As IntPtr, ByVal lParam
As IntPtr) As Boolean
Public Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As
CallBack, ByVal lParam As Integer) As Integer
"The application attempted to perform an operation not allowed by the
security policy."...
System.Security.SecurityException:
System.Security.Permissions.SecurityPermission...
Thoughts?
I was able to narrow the problem down the EnumWindows API call and
AddressOf Callback routine here:
Public Sub InitList()
Dim cb As CallBack
cb = New CallBack(AddressOf MyCallBack)
EnumWindows(cb, 0)
End Sub
Public Function MyCallBack(ByVal hwnd As IntPtr, ByVal lParam As
IntPtr) As Boolean
Dim intLen As Integer = GetWindowTextLength(hwnd) + 1
If intLen > 1 Then
Dim strText As New StringBuilder(intLen)
Try
GetWindowText(hwnd, strText, intLen)
If IsWindowEnabled(hwnd) And IsWindowVisible(hwnd) Then
lvWindows.Items.Add(strText.ToString).SubItems.Add(hwnd.ToString)
End If
Catch ex As Exception
Trace.WriteLine(ex.ToString)
End Try
End If
Return True
End Function
Public Delegate Function CallBack(ByVal hwnd As IntPtr, ByVal lParam
As IntPtr) As Boolean
Public Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As
CallBack, ByVal lParam As Integer) As Integer