2009-10-20 47 views

回答

0

試試下面的簽名

public partial class NativeMethods { 

    /// Return Type: BOOL->int 
    ///hInternet: void* 
    ///dwOption: DWORD->unsigned int 
    ///lpBuffer: LPVOID->void* 
    ///dwBufferLength: DWORD->unsigned int 
    [System.Runtime.InteropServices.DllImportAttribute("<Unknown>", EntryPoint="InternetSetOption")] 
    [return: System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] 
public static extern bool InternetSetOption([System.Runtime.InteropServices.InAttribute()] System.IntPtr hInternet, uint dwOption, [System.Runtime.InteropServices.InAttribute()] System.IntPtr lpBuffer, uint dwBufferLength) ; 

} 
0

PInvoke pageInternetSetOption函數指定它怎麼可以聲明,與一些方便的示例代碼。單獨

的聲明將是以下幾點:

public struct INTERNET_PROXY_INFO 
{ 
    public int dwAccessType; 
    public IntPtr proxy; 
    public IntPtr proxyBypass; 
} 

[DllImport("wininet.dll", SetLastError = true)] 
private static extern bool InternetSetOption(IntPtr hInternet, 
    int dwOption, IntPtr lpBuffer, int lpdwBufferLength); 
相關問題