http://www.cnblogs.com/benwu/p/4132026.html
https://msdn.microsoft.com/zh-cn/library/windows/desktop/ff818516(v=vs.85).aspx
1.通过URL获取域名:
将hashvalue.dll放入bin中,并右键项目->属性-》build-》平台:x64:
[DllImport("hashvalue.dll", EntryPoint = "GetUrlDomainW", CharSet = CharSet.Unicode)]
public static extern bool GetUrlDomain(
string url,
ref UInt32 domainBegin,
ref UInt32 domainLength);
public static string GetUrlDomain(string url)
{
UInt32 uDomainBegin = 0;
UInt32 uDomainLength = 0;
GetUrlDomain(url, ref uDomainBegin, ref uDomainLength);
return url.Substring((int)uDomainBegin, (int)uDomainLength);
}
string domain =GetUrlDomain("http://www.microsoft.com/test.html");//microsoft.com
2.messagebox:
[DllImport("User32.dll")]
public static extern int MessageBox(int h, string m, string c, int type);