views:

258

answers:

1

When I open the properties on a network connnection on windows, I see this dialog: Connection_Properties

In this dialog, in the check-listbox I can enable or disable options like "File or printer sharing", "client for microsoft networks" or network filter drivers.

My question is: How can I enable/disable these options programatically? I didn't find anything that looks like this in the WMI documentation and I couldn't find any other Win32 API for this. I would prefer a C Win32 API or WMI interface, but a solution using any programming language is welcome. The question is language-agnostic.

+1  A: 

I think INetCfg is what you're looking for:

http://msdn.microsoft.com/en-us/library/ff547694%28VS.85%29.aspx

Edit: Here's a link to a discussion where someone uses INetCfg to disable just File & Printer sharing.

http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/b0407073-07bc-462b-9de9-7295be5fa183

ho1
Thank you very much! It took me some time to figure out how it works, but this seems to be the right interface.
nikie