473,387 Members | 1,760 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

IInternetZoneManager and questions about Type Libraries

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
5 2760
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
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
Nobody to help me ?
It is a little bit urgent :)

Thanks,

Guillaume

Aug 11 '07 #4
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
>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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: jwsacksteder | last post by:
I have a working COM object that registers and I can 'dispatch' correctly. I need register a type library for this project to integrate with my application- Crystal Reports. I understand I need...
0
by: Geir Baardsen | last post by:
Hi! I took the routine from Gastronor.mdb: In the frmOrderDetails -> ITemID_AfterUpdate: Dim strFilter as String strFilter = "ItemID = " & Me!ItemID but it didn't work on win 2000 with...
16
by: Randy Yates | last post by:
I have an Access database that has been running fine on multiple platforms (Windows 2000, Windows XP, etc.) for several years. Recently, the database has begun to issue "Run-Time Error 2467" on...
17
by: Synic | last post by:
Hi guys. It's been a while since I've done programming in C. What I'm after is a multi-platform library (X11 and MS Windows at a minimum) which is not C++ that will let me program GUI apps....
33
by: Daniel Fadlun | last post by:
Is there a bigger, mathematical, data type in C than the double (64 bit) one or the old long double (80 bit)? I'd like to add precision to my mathematical application, but I can't figure out how....
0
by: Udo | last post by:
Hello, I want to use COM for automating an app via Python. On my PC are two versions of that app installed, therefore I have two type libraries. My questions are: 1. I had to manually create...
1
by: fbowden | last post by:
I have an access database which I wish to run on multiple PCs with a number of differnet users. Part of the the code in this database application uses the DAO 3.6 Object library. I know I can set a...
1
by: Omatase | last post by:
Here is my code: CDO.Message iMessage = new CDO.MessageClass(); string sFrom; string sDate; iMessage.DataSource.Open(bstrURLItem,null, ADODB.ConnectModeEnum.adModeRead,...
4
by: AzizMandar | last post by:
C++ Event Coding Questions I have done some simple programs in C++ and read a lot of good C++ books (Including The C++ Programing Language, and C++ Primer) I am trying to understand and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.