코딩하는 나귀

필요한 순서만 한글로 적자면...
1. 상수를 선언한다.
2. SHAutoComplete API를 선언해준다.
3. SHAutoComplete API를 적당한 초기 지점에서 호출해 준다.
   ( 핸들로는 꼭 에디트의 핸들을 주어야 하고 콤보박스의 경우 에디트의 핸들을 얻어서 넘겨주어야 함)

참고 : 파라미터에 따라서 자동완성 되는 목록 내용이 달라진다. 귀차니즘으로 필요하면 찿아보도록...;;
사용자 삽입 이미지



Starting from IE 5.5 Microsoft added a very cool feature to any editboxes/comboboxes - you may start to enter some value and automatically will be suggested a value from "list" (previous typed)

As you understand now I'll describe how to add such possibility to any editbox from your application:-)

1. you must declare a few const values:
const
SHACF_AUTOSUGGEST_FORCE_ON = $10000000;
SHACF_AUTOSUGGEST_FORCE_OFF = $20000000;
SHACF_AUTOAPPEND_FORCE_ON = $40000000;
SHACF_AUTOAPPEND_FORCE_OFF = $80000000;
SHACF_DEFAULT = $0;
SHACF_FILESYSTEM = $1;
SHACF_URLHISTORY = $2;
SHACF_URLMRU = $4;

2. you must declare a SHAutoComplete function from Shlwapi.dll library:
function SHAutoComplete(hwndEdit: HWnd; dwFlags: DWORD): HResult; stdcall; external 'Shlwapi.dll';

3. now you're ready to add an autosuggestion to your editbox:
var
  Options: dWord;
begin
  Options := SHACF_FILESYSTEM or SHACF_URLHISTORY or SHACF_URLMRU or
              SHACF_AUTOSUGGEST_FORCE_ON or SHACF_AUTOAPPEND_FORCE_ON;
  SHAutoComplete(yourEditBox.Handle, Options);
end;

Of course, you may remove some flags from Options parameter. For example, if you'll exclude the SHACF_URLHISTORY flag, end-user will not see the history of visited URLs

NOTE:
if your application must work in any environment (not only with IE 5.5+), then better to load Shlwapi.dll library dinamically but not link as I shown in this tip. You may read a tip#130 where I described how to work with dll's: Article# 130

원문 : http://www.scalabium.com/faq/dct0148.htm