unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 =
class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
function DlgFunc(hwnd: HWND; umsg: UINT; wparam: WPARAM; lparam: LPARAM): BOOL;
stdcall;
begin
Result := True;
case umsg
of
WM_INITDIALOG:
begin
SetDlgItemText(hwnd, 1001, '
Here the text will be received')
end;
WM_CLOSE:
begin
end;
WM_COMMAND:
else
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
DlgWnd:Hwnd;
Msg: TMSG;
i:integer;
begin
DlgWnd:=CreateDialog(hInstance, MakeIntResource(1), 0, @dlgfunc);
if IsWindow(DlgWnd)
then
begin
ShowWindow(DlgWnd,SW_SHOWNORMAL);
UpdateWindow(DlgWnd);
while GetMessage(Msg,0,0,0)
do
if not IsDialogMessage(DlgWnd, Msg)
then
begin
TranslateMessage(Msg);
Dispatch(Msg);
end;
end
else
begin
i:=integer(GetLastError);
showmessage(inttostr(i));
end;
end;
end.