/// <summary> /// Invokes <c>InternetSetStatusCallback</c>, handling error conditions. Returns the wrapper for the delegate, which is actually passed to <c>InternetSetStatusCallback</c>. /// </summary> /// <param name="internet">The internet handle.</param> /// <param name="callback">The internet status callback delegate, used to report progress.</param> /// <returns>The wrapper created for <paramref name="callback"/>, which is actually passed to the unmanaged <c>InternetSetStatusCallback</c> function.</returns> public static object InternetSetStatusCallback(SafeInternetHandle internet, InternetHandle.InternetCallback callback) { // Note: this will only work for synchronous callbacks! Asynchronous callbacks are not yet supported. InternetStatusCallback ret = CreateInternetStatusCallback(callback); if (DoInternetSetStatusCallback(internet, ret) == INTERNET_INVALID_STATUS_CALLBACK) { throw GetLastInternetException(); } return(ret); }
private static extern IntPtr DoInternetSetStatusCallback(SafeInternetHandle hInternet, InternetStatusCallback lpfnInternetCallback);