By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,771 Members | 1,709 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,771 IT Pros & Developers. It's quick & easy.

IInternetZoneManager and questions about Type Libraries

P: n/a
Hello,

I am trying to implement IInternetZoneManager Com Interface into my c#
project to be able to programaticaly edit the "Require server
verification (HTTPS) for all sites in this zone" checkbox in IE zones.

This Interface provide a SetZoneAttributes() Method that could help me
to acheive this goal.
But I don't find this class in my registry (Vista / IE7, even on a
Win03 / IE6).

I was able to implement the IInternetSecurityManager without any
problem, but no ways for IInternetZoneManager ...
I even do not find any informations about GUID or CLSID for this class
on MSDN or globaly on the internet (http://msdn2.microsoft.com/en-us/
library/ms537079.aspx) ...

Do anybody has already implemented this Com Interface ?
It seems that the Com server for this interface is UrlMon.dll ... Is
there a way to generate a .Net Type Library for this file ?

I got the UrlMon.Idl file from the Plateform SDK ... It seemed there
is a way to generate a .Net Type Library from a *.Idl file, but I
don't know how ...

Thanks for your help,

Guillaume, from Paris FR

Aug 10 '07 #1
Share this Question
Share on Google+
5 Replies


P: n/a
CLSID 7b8a2d95-0ac9-11d1-896c-00c04Fb6bfc4
reference
https://msdn2.microsoft.com/en-us/library/bb250487.aspx -
msdn2.microsoft.com/en-us/library/ms537182.aspx
msdn2.microsoft.com/en-us/library/ms537027.aspx
comdef.h in Windows SDK
--
Sheng Jiang
Microsoft MVP in VC++
"gbraux" <gb****@supinfo.comwrote in message
news:11**********************@i13g2000prf.googlegr oups.com...
Hello,

I am trying to implement IInternetZoneManager Com Interface into my c#
project to be able to programaticaly edit the "Require server
verification (HTTPS) for all sites in this zone" checkbox in IE zones.

This Interface provide a SetZoneAttributes() Method that could help me
to acheive this goal.
But I don't find this class in my registry (Vista / IE7, even on a
Win03 / IE6).

I was able to implement the IInternetSecurityManager without any
problem, but no ways for IInternetZoneManager ...
I even do not find any informations about GUID or CLSID for this class
on MSDN or globaly on the internet (http://msdn2.microsoft.com/en-us/
library/ms537079.aspx) ...

Do anybody has already implemented this Com Interface ?
It seems that the Com server for this interface is UrlMon.dll ... Is
there a way to generate a .Net Type Library for this file ?

I got the UrlMon.Idl file from the Plateform SDK ... It seemed there
is a way to generate a .Net Type Library from a *.Idl file, but I
don't know how ...

Thanks for your help,

Guillaume, from Paris FR

Aug 10 '07 #2

P: n/a
Thanks,

Here is the code I wrote to implement IInternetZoneManager ....

--------------------------------

private static IInternetZoneManager _izm; // IInternetZoneManager
interface of ZoneManager COM object
private static object _zoneManager;
private static Guid CLSID_InternetZoneManager = new
Guid("7b8a2d95-0ac9-11d1-896c-00c04Fb6bfc4");
private static Guid IID_IInternetZoneManager = new Guid("79eac9ef-
baf9-11ce-8c82-00aa004ba90b");

private static void InitComObjects()
{
Type t2 = Type.GetTypeFromCLSID(CLSID_InternetZoneManager);
_zoneManager = Activator.CreateInstance(t);
_izm = (IInternetZoneManager)_zoneManager;
}

[ComImport, GuidAttribute("79eac9ef-baf9-11ce-8c82-00aa004ba90b"),
InterfaceTypeAttribute(ComInterfaceType.InterfaceI sIUnknown)]
private interface IInternetZoneManager
{
[return: MarshalAs(UnmanagedType.I4)]
[PreserveSig]
int GetZoneAttributes(UInt32 dwZone, out _ZONEATTRIBUTES
pZoneAttributes);
}

------------------------------------------------------
But it do not work .... A first sight, a GUID/CLSID problem ...
"Unable to cast COM object of type 'System.__ComObject' to interface
type 'IInternetZoneManager'. This operation failed because the
QueryInterface call on the COM component for the interface with IID
'{79EAC9EF-BAF9-11CE-8C82-00AA004BA90B}' failed due to the following
error: No such interface supported (Exception from HRESULT: 0x80004002
(E_NOINTERFACE))."

I tried to use this interface in native C++ using CoCreateInstance,
and it works fine ...

Any ideas to bring this problem out ?
Thanks,

Guillaume

Aug 10 '07 #3

P: n/a
Nobody to help me ?
It is a little bit urgent :)

Thanks,

Guillaume

Aug 11 '07 #4

P: n/a
IInternetZoneManager seemed not to be registered in the registry in
Vista & Win03 (not tested on XP)...
Is there a way to do a ComImport on a unregistered Com interface (but
the master class CLSID is well registered).

Thanks

Guillaume

Aug 11 '07 #5

P: n/a
>IInternetZoneManager seemed not to be registered in the registry in
Vista & Win03 (not tested on XP)...
Is there a way to do a ComImport on a unregistered Com interface (but
the master class CLSID is well registered).
In this case it doesn't matter if the interface is registered or not.

Your code works on my machine. Are you running it from an STA thread?

FYI you don't have to use Type.GetTypeFromCLSID and
Activator.CreateInstance, you can declare and instantiate a class like
any other if you use the right attributes:

[ComImport, Guid("7b8a2d95-0ac9-11d1-896c-00c04Fb6bfc4")]
class InternetZoneManager {}
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Aug 12 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.