////这是我摘录的,但对IE页面中的edit无效,但能否有类似的解决方法
使编辑框具有类似IE的自动完成功能在shwlapi.dll中有一个函数SHAutoComplete。调用这个函数可以给Edit控件添加自动完成的功能。
注意:调用这个函数前一定要先调用ole初始化函数CoInitialize。下面是例子程序:
unit AutoCompleteUnit;
interface
uses Windows, StdCtrls, ComObj;//comobj的初始化部分调用了coInitialize函数,所以等于隐式调用了这个函数
Const
SHACF_DEFAULT = $0;
SHACF_FILESYSTEM = $1;
SHACF_URLHISTORY = $2;
SHACF_URLMRU = $4;
SHACF_URLALL = (SHACF_URLHISTORY Or SHACF_URLMRU);
SHACF_AUTOSUGGEST_FORCE_ON = $10000000;
SHACF_AUTOSUGGEST_FORCE_OFF = $20000000;
SHACF_AUTOAPPEND_FORCE_ON = $40000000;
SHACF_AUTOAPPEND_FORCE_OFF = $80000000;
function AutoComplete(editField: TEdit; dwFlags: DWORD): Boolean;
implementation
function SHAutoComplete(hwndEdit: HWND; dwFlags: dWord): LongInt;
stdcall; external 'shlwapi.dll';
function AutoComplete(editField: TEdit; dwFlags: DWORD): Boolean;
begin
Result := (SHAutoComplete(editField.Handle, dwFlags) = 0);
end;
end.