2009-10-20 40 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); 
相关问题