From: mohunt on 6 Oct 2009 11:11 I have written a WM 5.0 CF 3.5 vb.net app that tries to pinvoke InternetErrorDlg to display a list of certificates to use for authentication to a web service. I getting the error ERROR_INVALID_HANDLE. I get this error whether set the hWnd parameter to Null, the Handle property of the WinForm, or I use GetDesktopWindow from coredll.dll to obtain the handle. My is code is below. Any help would be greatly appreciated <DllImport("WinInet.dll", _ EntryPoint:="InternetErrorDlg", _ CharSet:=CharSet.Unicode, SetLastError:=True)> _ Private Shared Function InternetErrorDlg( _ ByVal hWnd As IntPtr, _ ByRef hRequest As IntPtr, _ ByVal dwError As Int32, _ ByVal dwFlags As Int32, _ ByRef lpdwIndex As Int32) As Int32 End Function iFlags = FLAGS_ERROR_UI_FLAGS_GENERATE_DATA + FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS lppvData = IntPtr.Zero hWnd = GetDesktopWindow() iResult = InternetErrorDlg(hWnd, m_Request, iError, iFlags, lppvData) Select Case iResult Case ERROR_SUCCESS Case ERROR_CANCELLED m_ErrorMessage = "The function was canceled by the user" Case ERROR_INTERNET_FORCE_RETRY m_ErrorMessage = "Function needs to redo its request" Case ERROR_INVALID_HANDLE m_ErrorMessage = "InternetErrorDlg: The handle to the parent window is invalid" Case Else m_ErrorMessage = "InternetErrorDlg: Error #" + iResult.ToString() End Select
|
Pages: 1 Prev: In-Reply-To Email Header Next: 56 Opinion Dsiconsolas.com |