Registriert seit: 31. Jul 2004
Ort: Berlin
84 Beiträge
Delphi XE2 Professional
|
EN_CHANGE bei Edit-Feld funzt nicht (WinApi)
15. Okt 2006, 16:14
hoi,
also wenn man bei meinem Edit-Feld irgendwas eingibt soll das EN_CHANGE Event abgefangen werden aber irgendwie funzt das nicht
hier mein Quelltext:
Delphi-Quellcode:
program Unit1_nvc;
uses
Windows,
Messages, CommCtrl, CommDlg;
{$INCLUDE CompilerSwitches.pas}
const
ID_Form1 = 101;
IDC_EDIT1 = 1203;
IDC_LABEl1 = 1503;
clSkyBlueBrushTemplate: TLogBrush =
(
lbStyle: BS_SOLID;
lbColor: $00f0caa6;
lbHatch: 0
);
var
Form1IsModeless : bool = false;
hForm1dlg : dword = 0;
clSkyBlueBrush : HBRUSH;
hwndEdit1, hwndLabel1: hwnd;
{$R Unit1_nvr.res}
procedure Form1OnCreate( dhwnd: hwnd );
begin
hwndLabel1 := CreateWindowEx(0, 'STATIC', 'Eingabe:', SS_LEFT or WS_GROUP or WS_CHILD or WS_VISIBLE,
8, 8, 70, 18, dhwnd, IDC_LABEl1, hInstance, nil );
hwndEdit1 := CreateWindowEx(WS_EX_CLIENTEDGE, 'EDIT', '', WS_VISIBLE or
WS_CHILD or ES_NOHIDESEL, 8, 25, 245, 21, dhWnd, IDC_EDIT1, hInstance, nil);
end;
{$IFNDEF DELPHI4UP}
const
ICON_SMALL = 0;
ICON_BIG = 1;
{$ENDIF}
FUNCTION Form1dlgfunc(dhwnd: hwnd; dumsg: dword; dwparam: wparam; dlparam: lparam): longbool; STDCALL;
var
iState: Integer;
BEGIN
result := true;
CASE dumsg OF
WM_INITDIALOG:
BEGIN
hForm1dlg := dhWnd;
Form1OnCreate( dhwnd );
END;
WM_CLOSE:
BEGIN
EndDialog(dhWnd, 0);
END;
// hier soll das event abgefangen werden
WM_COMMAND:
begin
if IDC_EDIT1 = EN_CHANGE then
MessageBox( dhwnd, 'test', ' test', 0 );
end;
ELSE
result := false;
END;
If (hForm1dlg <> 0) and not (dhwnd = hForm1dlg) then
If not Result then
Result := LongBool(CallWindowProc(Pointer(GetProp(dhwnd, 'OldWndProc')), dhwnd, dumsg, dwparam, dlparam));
END;
procedure Form1Show(AParent : dword {= 0});
begin
If IsWindow(hForm1Dlg) then
begin
ShowWindow(hForm1Dlg, sw_ShowNormal);
Exit;
end;
clSkyBlueBrush := CreateBrushIndirect(clSkyBlueBrushTemplate);
Form1IsModeless := true;
hForm1Dlg := CreateDialogParam(HInstance, MAKEINTRESOURCE(ID_Form1), AParent, @Form1DlgFunc, 0);
ShowWindow(hForm1Dlg, sw_ShowNormal);
end;
procedure Form1Close;
begin
SendMessage(hForm1Dlg, WM_CLOSE, 0, 0);
DeleteObject(clSkyBlueBrush);
end;
begin
clSkyBlueBrush := CreateBrushIndirect(clSkyBlueBrushTemplate);
Form1IsModeless := false;
DialogBoxParam(HInstance, MAKEINTRESOURCE(ID_Form1), 0, @Form1DlgFunc, 0);
DeleteObject(clSkyBlueBrush);
end.
was hab ich da falsch gemacht?
|