Registriert seit: 29. Mai 2002
37.621 Beiträge
Delphi 2006 Professional
|
Re: TOpendialog verändern
7. Sep 2004, 20:09
Delphi-Quellcode:
procedure TForm1.OpenDlgOnShow(Sender: TObject);
var
hParent: THandle;
rect: TRect;
hEdit: THandle;
begin
hParent := GetParent(OpenDialog1.Handle);
GetWindowRect(hParent, rect);
SetWindowPos(hParent, 0, 0, 0, rect.Right - rect.Left, rect.Bottom - rect.Top
+ 25, SWP_NOMOVE);
hEdit := CreateWindowEx(WS_EX_CLIENTEDGE, 'EDIT', '', WS_VISIBLE or WS_CHILD,
195, 318, 150, 20, hParent, 101, 0, nil);
if hEdit = 0 then
RaiseLastOSError;
end;
procedure TForm1.OpenDlgOnClose(Sender: TObject);
var
hParent: THandle;
hEdit: THandle;
Buffer: PChar;
len: Integer;
begin
hParent := GetParent(OpenDialog1.Handle);
hEdit := GetDlgItem(hParent, 101);
len := SendMessage(hEdit, WM_GETTEXTLENGTH, 0, 0);
GetMem(Buffer, len+1);
try
SendMessage(hEdit, WM_GETTEXT, len, lParam(Buffer));
ShowMessage(Buffer);
finally
FreeMem(Buffer, len+1);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
OpenDialog1.OnShow := OpenDlgOnShow;
OpenDialog1.OnClose := OpenDlgOnClose;
if OpenDialog1.Execute then
begin
ShowMessage(OpenDialog1.FileName);
end;
end;
So geht's.
Michael Ein Teil meines Codes würde euch verunsichern.
|
|
Zitat
|