Multimobile Development: Building Applications for any Smartphone
InternetQueryOption
Messages   Related Types
This message was discovered on microsoft.public.dotnet.languages.csharp.


John
I am trying to call InternetQueryOption from c# and am having some problems:

class Wininet
{
[DllImport("Wininet.dll")]
public static extern int InternetQueryOption (IntPtr hInternet, int
dwOption, IntPtr buffer, ref int dwBufferLength );
public const int INTERNET_OPTION_PROXY = 38;
}

I try to call it with the following (just trying to get the length of the
buffer initially):

int iLen = 0;
int iRet = Wininet.InternetQueryOption (IntPtr.Zero,
Wininet.INTERNET_OPTION_PROXY, IntPtr.Zero, ref iLen);

I get false returned. The value of GetLastWin32Error() is 126
(ERROR_MOD_NOT_FOUND), The specified module could not be found.

I ran the depends utility on wininet.dll in my system32 directory and get
the following:

Warning: At least one delay-load dependency module was not found.
Warning: At least one module has an unresolved import due to a missing
export function in a delay-load dependent module.

The offending file is APPHELP.DLL. This file is in fact missing. I did
some research on this file and it turns out that other people are having
problems with it. I have so far found out that the file only exists on XP.
The dependency is from SHLWAPI.DLL. This was introduced with IE6 on Windows
2000. Some people have tried compying the APPHELP.DLL file across to
Windows 2000 and it does not work.

I have some questions:

1) Has anyone come across this and what did they do?
2) Why would a delay load dependency stop the function working? I assume
that the function I am calling does not require the APPHELP.DLL file?
3) Anyone got InternetQueryOption working on a Windows 2000 machine with
IE6?
4) Anyone else have the missing dependency for APPHELP.DLL on Windows 2000
with IE6?
5) Anyone know of a better way to get *and* set the proxy options in IE (not
using the registry as that has its own problems).
6) Is the error I get (126) definitely due to this dependency or is it that
I am calling the function incorrectly?
7) Is this another reason everyone should upgrade to XP? ;-)

Thanks!
John.

Reply to this message...
Vote that this is a GOOD answer...
 
Really good experience at the Apple Store
MonoDroid – looking *awesome*
 
    
James F. Bellinger
"John" <Click here to reveal e-mail address> wrote in message
news:vJV09.1981$Click here to reveal e-mail address...
> 5) Anyone know of a better way to get *and* set the proxy options in IE
(not
> using the registry as that has its own problems).

For retrieving proxy settings, there is a far more portable route than the
one
you are using. :-) Have a look at System.Net.GlobalProxySelection, or
the Proxy member of a HttpWebRequest (either one will do, I suppose).
Though this may not be exactly what you are looking for. For setting, I
really
couldn't tell you. :-)

Have a nice day :-)
Jim Bellinger

Reply to this message...
Vote that this is a GOOD answer...
 
First volume of Multimobile Development nearly ready to go to press
A mention on Developing for the iPhone and Android: The pros and cons
 
    
John
"James F. Bellinger" <Click here to reveal e-mail address> wrote in message
news:yRW09.176445$Click here to reveal e-mail address...
[Original message clipped]

Thank you for the suggestions.

The problem with these 2 methods is that according to the docs they do not
set the proxy for IE, just the ones for the .NET framework classes.

For my application I really need the proxy that IE uses to be changed.

John.

Reply to this message...
Vote that this is a GOOD answer...
 
 
 
System.IntPtr
System.Net.GlobalProxySelection
System.Net.HttpWebRequest




Ad
BootFX
Reliable and powerful .NET application framework.
iOS, Android and Windows Phone Development Training and Consultancy
Hosted by RackSRV Communications
 
Multimobile Development: Building Applications for any Smartphone
Copyright © AMX Software Ltd 2008-2010. Portions copyright © Matthew Baxter-Reynolds 2001-2010. All rights reserved.
Contact Us - Terms of Use - Privacy Policy - 4.0.30129.1734