yyy Posted January 21, 2005 Share Posted January 21, 2005 Hi, Does anybody know how to get the name of the current Internet connection? I tried to do it using RAS but couldn't. Any ideas ? Link to comment Share on other sites More sharing options...
0 lexecutil Posted January 26, 2005 Share Posted January 26, 2005 (edited) Ok try this: [Flags] public enum InternetState { INTERNET_CONNECTION_MODEM = 0x01, INTERNET_CONNECTION_LAN = 0x02, INTERNET_CONNECTION_PROXY = 0x04, INTERNET_CONNECTION_MODEM_BUSY = 0x08, INTERNET_RAS_INSTALLED = 0x10, INTERNET_CONNECTION_OFFLINE = 0x20, INTERNET_CONNECTION_CONFIGURED = 0x40 } [DllImport("wininet.dll", CharSet=CharSet.Auto)] public static extern bool InternetGetConnectedStateEx(out InternetState lpdwFlags, StringBuilder lpszConnectionName, int dwNameLen, int dwReserved); ............ InternetState connectionState; StringBuilder connectionName = new StringBuilder(256); bool isOnline = InternetGetConnectedStateEx(out connectionState, connectionName, 256, 0); MessageBox.Show(isOnline.ToString()); MessageBox.Show(connectionState.ToString()); MessageBox.Show(connectionName.ToString()); Hopfully that will fix your problem :) Dan EDIT: Decided I may aswell add the InternetState enum for you :) EDIT #2: Changed return type to boolean for the isOnline variable. :) Edited January 26, 2005 by dannyres Link to comment Share on other sites More sharing options...
0 yyy Posted January 26, 2005 Author Share Posted January 26, 2005 :woot: :woot: :woot: :woot: :woot: :woot: :woot: YESSSSSSSSSSSSSSSSS :cool: :laugh: :) :rofl: :laugh: :cool: :jump: :fun: It works (Y) I can't believe it - just as I wanted it. You are so great dannyres (Y) I couldn't have done it without you. Sorry for bothering you and thank you very much. Thanks also to Andareed for trying to help :) Link to comment Share on other sites More sharing options...
0 lexecutil Posted January 27, 2005 Share Posted January 27, 2005 Not a problem :) Glad I could finally help you work it out :D Dan Link to comment Share on other sites More sharing options...
0 yyy Posted January 27, 2005 Author Share Posted January 27, 2005 I'll add your nick name to my application's About tab :) Link to comment Share on other sites More sharing options...
0 yyy Posted January 28, 2005 Author Share Posted January 28, 2005 Just one question: How do I get the connetion status of a specific connection? I want to get each of the connection entries' connection status. Link to comment Share on other sites More sharing options...
0 lexecutil Posted January 30, 2005 Share Posted January 30, 2005 Ahh if you need todo that you're going to have to go back to the RAS method :p Dan Link to comment Share on other sites More sharing options...
0 yyy Posted January 30, 2005 Author Share Posted January 30, 2005 Ok, I'll try that. Thanks :) Link to comment Share on other sites More sharing options...
0 JeffW Posted March 4, 2009 Share Posted March 4, 2009 This might be an old thread, but if you're interested in using RAS from .NET languages (ie: C# or VB.NET) you may want to check out the DotRas project on CodePlex. http://www.codeplex.com/DotRas Link to comment Share on other sites More sharing options...
Question
yyy
Hi,
Does anybody know how to get the name of the current Internet connection? I tried to do it using RAS but couldn't.
Any ideas ?
Link to comment
Share on other sites
33 answers to this question
Recommended Posts