में विंडोज डायलिंग नियमों को कैसे ढूंढें यह सरल होना चाहिए, लेकिन जाहिर है। चूंकि .. विन्डोज़ 3 या तो, फोन या फोन & मॉडेम नामक एक नियंत्रण कक्ष है। उस नियंत्रण कक्ष में मॉडेम डायल अप करने के तरीके के बारे में जानकारी का एक समूह है, यह मानते हुए कि आपके पास मॉडेम लगा हुआ है। उदाहरण के लिए, क्या आपको बाहर निकलने के लिए 9 डायल करने की आवश्यकता है, क्षेत्र कोड क्या है, और बहुत आगे। मैं इस जानकारी को प्रोग्रामेटिक रूप से कैसे एक्सेस कर सकता हूं? मैं सी # .NET 2010 का उपयोग कर रहा हूं।.NET
.NET
उत्तर
मैं पहुँच के लिए एक रास्ता नहीं मिल सका यह एक के माध्यम से टी तापी आवरण (एक बहुत लंबे समय नहीं खोज के बाद) तो मैं ऊपर निकाल दिया procmon एक पाया जहां यह रजिस्ट्री में जमा हो गया था, और यहाँ कोड है कि यह तक पहुँचता है (यदि आप अपने विशिष्ट आवश्यकताओं के अनुकूल कर सकते हैं) है:
RegistryKey locationsKey =
Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Telephony\Locations");
if (locationsKey == null) return;
string[] locations = locationsKey.GetSubKeyNames();
foreach (var location in locations)
{
RegistryKey key = locationsKey.OpenSubKey(location);
if (key == null) continue;
Console.WriteLine("AreaCode {0}",key.GetValue("AreaCode"));
Console.WriteLine("Country {0}",(int) key.GetValue("Country"));
Console.WriteLine("OutsideAccess {0}", key.GetValue("OutsideAccess"));
}
नोट:
- मैं अगर वहाँ एक .net संगत से एक है एक अधिकारी एपीआई का उपयोग करने की सलाह देते हैं।
Process.Start(@"C:\Windows\System32\rundll32.exe",@"C:\Windows\System32\shell32.dll,Control_RunDLL C:\Windows\System32\telephon.cpl");
आपको विंडोज़ में तापी का उपयोग करने या रजिस्ट्री से जानकारी खींचने की आवश्यकता होगी। माइक्रोसॉफ्ट तापी 3.0 के मुताबिक प्रबंधित कोड से इस्तेमाल नहीं किया गया था, हालांकि पहला लिंक ऐसा करने लगता है।
कुछ लेख देखने के लिए पर:
- :
# 2
लिंक से इन तापी कार्यों पर एक नजर डालें
lineGetTranslateCaps
lineTranslateAddress
lineTranslateDialog
lineSetCurrentLocation
lineGetCountry
tapiGetLocationInfo
जानकारी पर रजिस्ट्री में संग्रहीत है: HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Telephony\Locations
:
class Program
{
static void Main(string[] args)
{
string rootLocation = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Telephony\Locations";
getRegistryValues(rootLocation);
Console.ReadLine();
}
public static void getRegistryValues(string rootLocation)
{
RegistryKey locationsKey =
Registry.LocalMachine.OpenSubKey(rootLocation);
if (locationsKey == null) return;
string[] locations = locationsKey.GetSubKeyNames();
Console.WriteLine(locations.Length.ToString());
foreach (var location in locations)
{
Console.WriteLine(location.ToString());
RegistryKey key = locationsKey.OpenSubKey(location);
if (key == null) continue;
foreach (string keyName in key.GetValueNames())
{
if (keyName.Equals("Prefixes"))
{
string[] Prefixes = ((string[])(key.GetValue(keyName)));
Console.Write("Prefixes ");
foreach (string prefix in Prefixes)
{
Console.Write(prefix);
}
}
else
{
Console.WriteLine(keyName + " {0}", key.GetValue(keyName));
}
}
getRegistryValues([email protected]"\"+location);
}
}
यह बहुत अच्छा है, आप दोनों के लिए धन्यवाद। – Rob