Thema: Delphi Autocomplete (Combobox)

Einzelnen Beitrag anzeigen

hathor
(Gast)

n/a Beiträge
 
#3

AW: Autocomplete (Combobox)

  Alt 23. Nov 2014, 00:34
function SHAutoComplete(hwndEdit: HWnd; dwFlags: DWORD): HResult; stdcall; external 'Shlwapi.dll';
ist die Lösung:

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

Delphi-Quellcode:
unit AutoCompleteUnit;

interface

uses Windows, StdCtrls, ComObj;

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

type TShAutoCompleteFunc = function(hwndEdit: HWND; dwFlags: dWord): LongInt; stdcall;

var SHAutoComplete: TShAutoCompleteFunc;
     theDLL: THandle;

function AutoComplete(editField: TEdit; dwFlags: DWORD): Boolean;
begin
  if @ShAutoComplete <> nil then
     Result := (SHAutoComplete(editField.Handle, dwFlags) = 0)
  else
    Result := false;
end;

initialization
  theDLL := LoadLibrary('shlwapi.dll');
  if theDLL <> 0 then
    @ShAutoComplete := GetProcAdress(theDLL, 'SHAutoComplete');
finalization
  if theDLL <> 0 then FreeLibrary(theDLL);
end.
Angehängte Dateien
Dateityp: zip AutoComplete_Example.zip (546,6 KB, 55x aufgerufen)

Geändert von hathor (23. Nov 2014 um 01:21 Uhr)
  Mit Zitat antworten Zitat