如何取得浏览器的历史记录,读取为字符窜形式 就是读取到以后如何列出来(读取文件夹以后出现的是什么昨天、今天之类的), 如何列出所有浏览过的地址,就像IE History Manager(http://www.cleanersoft.com/iehistory/iehistory.htm)作的那样 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 using System.Runtime.InteropServices;[StructLayout(LayoutKind.Sequential)]public class INTERNET_CACHE_ENTRY_INFOW{ public uint dwStructSize; public string lpszSourceUrlName; public string lpszLocalFileName; public uint CacheEntryType; public uint dwUseCount; public uint dwHitRate; public uint dwSizeLow; public uint dwSizeHigh; public FILETIME LastModifiedTime; public FILETIME ExpireTime; public FILETIME LastAccessTime; public FILETIME LastSyncTime; public IntPtr lpHeaderInfo; public uint dwHeaderInfoSize; public string lpszFileExtension; public uint dwReserved; //union uint dwExemptDelta;}[DllImport("wininet.dll")]public static extern IntPtr FindFirstUrlCacheEntryEx( string lpszUrlSearchPattern, uint dwFlags, uint dwFilter, Int64 GroupId, IntPtr lpFirstCacheEntryInfo, ref uint lpdwFirstCacheEntryInfoBufferSize, Pointer lpGroupAttributes, Pointer pcbGroupAttributes, Pointer lpReserved);[DllImport("wininet.dll")]public static extern bool FindCloseUrlCache(IntPtr hEnumHandle);[DllImport("wininet.dll")]public static extern bool FindNextUrlCacheEntryEx( IntPtr hEnumHandle, IntPtr lpFirstCacheEntryInfo, ref uint lpdwFirstCacheEntryInfoBufferSize, Pointer lpGroupAttributes, Pointer pcbGroupAttributes, Pointer lpReserved);public uint NORMAL_CACHE_ENTRY = 0x00000001;private void button4_Click(object sender, EventArgs e){ IntPtr vHandle; INTERNET_CACHE_ENTRY_INFOW vInternetCacheEntryInfo = new INTERNET_CACHE_ENTRY_INFOW(); uint vFirstCacheEntryInfoBufferSize = 0; FindFirstUrlCacheEntryEx(null, 0, NORMAL_CACHE_ENTRY, 0, (IntPtr)null, ref vFirstCacheEntryInfoBufferSize, null, null, null); IntPtr vBuffer = Marshal.AllocHGlobal((int)vFirstCacheEntryInfoBufferSize); vHandle = FindFirstUrlCacheEntryEx(null, 0, NORMAL_CACHE_ENTRY, 0, vBuffer, ref vFirstCacheEntryInfoBufferSize, null, null, null); while (vHandle != null) { Marshal.PtrToStructure(vBuffer, vInternetCacheEntryInfo); richTextBox1.AppendText(vInternetCacheEntryInfo.lpszSourceUrlName + "\r\n"); Marshal.FreeCoTaskMem(vBuffer); FindNextUrlCacheEntryEx(vHandle, (IntPtr)null, ref vFirstCacheEntryInfoBufferSize, null, null, null); vBuffer = Marshal.AllocHGlobal((int)vFirstCacheEntryInfoBufferSize); if (!FindNextUrlCacheEntryEx(vHandle, vBuffer, ref vFirstCacheEntryInfoBufferSize, null, null, null)) break; } Marshal.FreeCoTaskMem(vBuffer);} Pointer是指指针?需要设置使用不安全代码?还是需要引用某一个DLL我这里编译不过阿 System.Reflection.Pointer我的调试环境是2005Pointer声明在System.Reflection命名空间你可以这样调试Pointer -> IntPtrnull -> IntPtr.Zero 设置combobox的AutoCompleteSource属性就行 不需要这么复杂,有一个com可以实现这种功能 hongyelzg(风中过客) ( ) 信誉:100 Blog 2007-03-09 12:21:29 得分: 0 不需要这么复杂,有一个com可以实现这种功能 哪一个??请指点一下,谢谢 textBox1.AutoCompleteSource = AutoCompleteSource.HistoryList AutoCompleteSource好像是2005特有的, 2003怎么获取呢? http://www.xfbbs.com/ArticleShow/84/Article_Show_24841.htmlhttp://www.ccwblog.cn/ylsun/post/20061120/13258.htm.net 2.0中的autocomplete正是通过此方法实现的,2.0中实现的原型private void SetAutoComplete(bool reset, bool recreate){ if (base.IsHandleCreated && (this.childEdit != null)) { if (this.AutoCompleteMode != AutoCompleteMode.None) { if ((!this.fromHandleCreate && recreate) && base.IsHandleCreated) { AutoCompleteMode autoCompleteMode = this.AutoCompleteMode; this.autoCompleteMode = AutoCompleteMode.None; base.RecreateHandle(); this.autoCompleteMode = autoCompleteMode; } if (this.AutoCompleteSource == AutoCompleteSource.CustomSource) { if (this.AutoCompleteCustomSource != null) { if (this.AutoCompleteCustomSource.Count == 0) { int flags = -1610612736; SafeNativeMethods.SHAutoComplete(new HandleRef(this, this.childEdit.Handle), flags); } else if (this.stringSource != null) { this.stringSource.RefreshList(this.GetStringsForAutoComplete(this.AutoCompleteCustomSource)); } else { this.stringSource = new StringSource(this.GetStringsForAutoComplete(this.AutoCompleteCustomSource)); if (!this.stringSource.Bind(new HandleRef(this, this.childEdit.Handle), (int) this.AutoCompleteMode)) { throw new ArgumentException(SR.GetString("AutoCompleteFailure")); } } } } else if (this.AutoCompleteSource == AutoCompleteSource.ListItems) { if (this.DropDownStyle == ComboBoxStyle.DropDownList) { int flags = -1610612736; SafeNativeMethods.SHAutoComplete(new HandleRef(this, this.childEdit.Handle), flags); } else if (this.itemsCollection != null) { if (this.itemsCollection.Count == 0) { int flags = -1610612736; SafeNativeMethods.SHAutoComplete(new HandleRef(this, this.childEdit.Handle), flags); } else if (this.stringSource != null) { this.stringSource.RefreshList(this.GetStringsForAutoComplete(this.Items)); } else { this.stringSource = new StringSource(this.GetStringsForAutoComplete(this.Items)); if (!this.stringSource.Bind(new HandleRef(this, this.childEdit.Handle), (int) this.AutoCompleteMode)) { throw new ArgumentException(SR.GetString("AutoCompleteFailureListItems")); } } } } else { try { int num4 = 0; if (this.AutoCompleteMode == AutoCompleteMode.Suggest) { num4 |= -1879048192; } if (this.AutoCompleteMode == AutoCompleteMode.Append) { num4 |= 0x60000000; } if (this.AutoCompleteMode == AutoCompleteMode.SuggestAppend) { num4 |= 0x10000000; num4 |= 0x40000000; } SafeNativeMethods.SHAutoComplete(new HandleRef(this, this.childEdit.Handle), ((int) this.AutoCompleteSource) | num4); } catch (SecurityException) { } } } else if (reset) { int flags = -1610612736; SafeNativeMethods.SHAutoComplete(new HandleRef(this, this.childEdit.Handle), flags); } }} AutoCompleteMode 不是还是2.0的?楼上的这个方法还是说明2005的吧 我提供的方法是2005的内部实现,原本就有的API方法, dotnet出现之前就有了的 既然2005用这个API实现,说明这应该是最合适的实现方法了 这个方法还是有些问题的,而且得到的结果不仅仅是历史,还包括一些cache里的东西。具体的我已经找到了http://www.codeproject.com/csharp/ponta.asp?df=100&forumid=67589&exp=0&select=897325这个是取到所有历史纪录的。 怎么样延长网站后台管理登录进去界面时间 对抽象类各位有较深认识的请赐教!!!!!!!!! HttpWebRequest.CookieContainer问题 使用LUMISOFT的IMAP获取邮件的小问题 播放mp3的问题 用Assembly装载的DLL,如何卸载? 如何打包一个c#的windows 应用程序? 请教MVC在ADO.NET中的实现 请大家帮我解释一下。看了 用C#实现的数据库抽象工厂(一) 不懂之处。 如何检测一个目录下面是否有文件产生,修改? 高手请进 急急急!!!求求大家快快帮忙(急急急!!!)
public class INTERNET_CACHE_ENTRY_INFOW
{
public uint dwStructSize;
public string lpszSourceUrlName;
public string lpszLocalFileName;
public uint CacheEntryType;
public uint dwUseCount;
public uint dwHitRate;
public uint dwSizeLow;
public uint dwSizeHigh;
public FILETIME LastModifiedTime;
public FILETIME ExpireTime;
public FILETIME LastAccessTime;
public FILETIME LastSyncTime;
public IntPtr lpHeaderInfo;
public uint dwHeaderInfoSize;
public string lpszFileExtension;
public uint dwReserved; //union uint dwExemptDelta;
}[DllImport("wininet.dll")]
public static extern IntPtr FindFirstUrlCacheEntryEx( string lpszUrlSearchPattern,
uint dwFlags,
uint dwFilter,
Int64 GroupId,
IntPtr lpFirstCacheEntryInfo,
ref uint lpdwFirstCacheEntryInfoBufferSize,
Pointer lpGroupAttributes,
Pointer pcbGroupAttributes,
Pointer lpReserved
);[DllImport("wininet.dll")]
public static extern bool FindCloseUrlCache(IntPtr hEnumHandle);[DllImport("wininet.dll")]
public static extern bool FindNextUrlCacheEntryEx(
IntPtr hEnumHandle,
IntPtr lpFirstCacheEntryInfo,
ref uint lpdwFirstCacheEntryInfoBufferSize,
Pointer lpGroupAttributes,
Pointer pcbGroupAttributes,
Pointer lpReserved);public uint NORMAL_CACHE_ENTRY = 0x00000001;private void button4_Click(object sender, EventArgs e)
{
IntPtr vHandle;
INTERNET_CACHE_ENTRY_INFOW vInternetCacheEntryInfo = new INTERNET_CACHE_ENTRY_INFOW();
uint vFirstCacheEntryInfoBufferSize = 0;
FindFirstUrlCacheEntryEx(null, 0, NORMAL_CACHE_ENTRY, 0, (IntPtr)null,
ref vFirstCacheEntryInfoBufferSize, null, null, null);
IntPtr vBuffer = Marshal.AllocHGlobal((int)vFirstCacheEntryInfoBufferSize);
vHandle = FindFirstUrlCacheEntryEx(null, 0, NORMAL_CACHE_ENTRY, 0,
vBuffer, ref vFirstCacheEntryInfoBufferSize,
null, null, null);
while (vHandle != null)
{
Marshal.PtrToStructure(vBuffer, vInternetCacheEntryInfo);
richTextBox1.AppendText(vInternetCacheEntryInfo.lpszSourceUrlName + "\r\n");
Marshal.FreeCoTaskMem(vBuffer); FindNextUrlCacheEntryEx(vHandle, (IntPtr)null, ref vFirstCacheEntryInfoBufferSize,
null, null, null);
vBuffer = Marshal.AllocHGlobal((int)vFirstCacheEntryInfoBufferSize);
if (!FindNextUrlCacheEntryEx(vHandle, vBuffer,
ref vFirstCacheEntryInfoBufferSize, null, null, null)) break;
}
Marshal.FreeCoTaskMem(vBuffer);
}
需要设置使用不安全代码?
还是需要引用某一个DLL我这里编译不过阿
我的调试环境是2005
Pointer声明在System.Reflection命名空间你可以这样调试
Pointer -> IntPtr
null -> IntPtr.Zero
不需要这么复杂,有一个com可以实现这种功能
哪一个??请指点一下,谢谢
http://www.ccwblog.cn/ylsun/post/20061120/13258.htm
.net 2.0中的autocomplete正是通过此方法实现的,2.0中实现的原型private void SetAutoComplete(bool reset, bool recreate)
{
if (base.IsHandleCreated && (this.childEdit != null))
{
if (this.AutoCompleteMode != AutoCompleteMode.None)
{
if ((!this.fromHandleCreate && recreate) && base.IsHandleCreated)
{
AutoCompleteMode autoCompleteMode = this.AutoCompleteMode;
this.autoCompleteMode = AutoCompleteMode.None;
base.RecreateHandle();
this.autoCompleteMode = autoCompleteMode;
}
if (this.AutoCompleteSource == AutoCompleteSource.CustomSource)
{
if (this.AutoCompleteCustomSource != null)
{
if (this.AutoCompleteCustomSource.Count == 0)
{
int flags = -1610612736;
SafeNativeMethods.SHAutoComplete(new HandleRef(this, this.childEdit.Handle), flags);
}
else if (this.stringSource != null)
{
this.stringSource.RefreshList(this.GetStringsForAutoComplete(this.AutoCompleteCustomSource));
}
else
{
this.stringSource = new StringSource(this.GetStringsForAutoComplete(this.AutoCompleteCustomSource));
if (!this.stringSource.Bind(new HandleRef(this, this.childEdit.Handle), (int) this.AutoCompleteMode))
{
throw new ArgumentException(SR.GetString("AutoCompleteFailure"));
}
}
}
}
else if (this.AutoCompleteSource == AutoCompleteSource.ListItems)
{
if (this.DropDownStyle == ComboBoxStyle.DropDownList)
{
int flags = -1610612736;
SafeNativeMethods.SHAutoComplete(new HandleRef(this, this.childEdit.Handle), flags);
}
else if (this.itemsCollection != null)
{
if (this.itemsCollection.Count == 0)
{
int flags = -1610612736;
SafeNativeMethods.SHAutoComplete(new HandleRef(this, this.childEdit.Handle), flags);
}
else if (this.stringSource != null)
{
this.stringSource.RefreshList(this.GetStringsForAutoComplete(this.Items));
}
else
{
this.stringSource = new StringSource(this.GetStringsForAutoComplete(this.Items));
if (!this.stringSource.Bind(new HandleRef(this, this.childEdit.Handle), (int) this.AutoCompleteMode))
{
throw new ArgumentException(SR.GetString("AutoCompleteFailureListItems"));
}
}
}
}
else
{
try
{
int num4 = 0;
if (this.AutoCompleteMode == AutoCompleteMode.Suggest)
{
num4 |= -1879048192;
}
if (this.AutoCompleteMode == AutoCompleteMode.Append)
{
num4 |= 0x60000000;
}
if (this.AutoCompleteMode == AutoCompleteMode.SuggestAppend)
{
num4 |= 0x10000000;
num4 |= 0x40000000;
}
SafeNativeMethods.SHAutoComplete(new HandleRef(this, this.childEdit.Handle), ((int) this.AutoCompleteSource) | num4);
}
catch (SecurityException)
{
}
}
}
else if (reset)
{
int flags = -1610612736;
SafeNativeMethods.SHAutoComplete(new HandleRef(this, this.childEdit.Handle), flags);
}
}
}
楼上的这个方法还是说明2005的吧
具体的我已经找到了
http://www.codeproject.com/csharp/ponta.asp?df=100&forumid=67589&exp=0&select=897325
这个是取到所有历史纪录的。