Sau rất nhiều googling, cuối cùng tôi đã nhận được câu trả lời. Sau hai liên kết giúp tôi có được máy hiện Location-
http://social.msdn.microsoft.com/Forums/eu/csharpgeneral/thread/6dfaa142-c588-4cb0-b044-fa1e8138b299
http://www.siao2.com/2007/02/21/1733999.aspx
tôi làm lớp tiện ích sau đây nếu ai quan tâm đến việc số- thức
public static class RegionAndLanguageHelper
{
#region Constants
private const int GEO_FRIENDLYNAME = 8;
#endregion
#region Private Enums
private enum GeoClass : int
{
Nation = 16,
Region = 14,
};
#endregion
#region Win32 Declarations
[DllImport("kernel32.dll", ExactSpelling = true, CallingConvention = CallingConvention.StdCall, SetLastError = true)]
private static extern int GetUserGeoID(GeoClass geoClass);
[DllImport("kernel32.dll")]
private static extern int GetUserDefaultLCID();
[DllImport("kernel32.dll")]
private static extern int GetGeoInfo(int geoid, int geoType, StringBuilder lpGeoData, int cchData, int langid);
#endregion
#region Public Methods
/// <summary>
/// Returns machine current location as specified in Region and Language settings.
/// </summary>
public static string GetMachineCurrentLocation()
{
int geoId = GetUserGeoID(GeoClass.Nation); ;
int lcid = GetUserDefaultLCID();
StringBuilder locationBuffer = new StringBuilder(100);
GetGeoInfo(geoId, GEO_FRIENDLYNAME, locationBuffer, locationBuffer.Capacity, lcid);
return locationBuffer.ToString().Trim();
}
#endregion
}
Nguồn
2012-01-17 07:44:34
@Sai Tôi nghĩ OP có nghĩa là vị trí địa lý. – Glenn
Tôi nghĩ rằng anh ấy muốn Vị trí như trong * Ukraina, Hoa Kỳ, Vương quốc Anh * như khôn ngoan và không liên quan gì đến văn hóa – V4Vendetta
Điều đó là chính xác. Ví dụ, tôi có thể có văn hóa của tôi như tiếng Anh (Hoa Kỳ) và vị trí của tôi là Ấn Độ. Bạn có thể thay đổi cả hai điều này một cách độc lập trong bảng điều khiển Vùng và Ngôn ngữ. –