var
WinClass : TWndClass;
WinClass1 : TWndClass;
Form : HWND;
Form1 : HWND;
Handle : HWND;
Msg : TMSG;
hFont : HWND;
Button1 : HWND; //TButton
function windowproc(hwnd: hwnd; msg: integer; wparam: wparam; lparam: lparam):lresult;stdcall;
begin
Result := DefWindowProc(hwnd, msg, wparam, lparam);
case Msg of
WM_COMMAND:
if (lParam = Button1) and (HiWord(wParam) = BN_CLICKED) then
begin
Form1 := GetModuleHandle(nil);
with WinClass do
begin
Style := WS_CHILD;
hIcon := LoadIcon(BUX, MAKEINTRESOURCE('APIXICON'));
lpfnWndProc := @WindowProc;
hInstance := Form1;
hbrBackground := COLOR_BTNFACE-13;
lpszClassName := 'TAPIxForm';
hCursor := LoadCursor(0, IDC_ARROW);
end;
InitCommonControls;
RegisterClass(WinClass);
Handle := CreateWindowEx(0, 'TAPIxForm', 'Form1',
WS_POPUP or WS_CHILD,
219, 116, 500, 366,
0, 0,
BUX, nil);
ShowWindow(Handle, SW_SHOW);
end;
WM_DESTROY: ShutDown;
Exit;
end;
end;
end;
begin
Form := GetModuleHandle(nil);
with WinClass do
begin
Style := CS_PARENTDC;
hIcon := LoadIcon(Form, MAKEINTRESOURCE('APIXICON'));
lpfnWndProc := @WindowProc;
hInstance := Form;
hbrBackground := COLOR_BTNFACE+15;
lpszClassName := 'TAPIxForm';
hCursor := LoadCursor(0, IDC_ARROW);
end;
InitCommonControls;
RegisterClass(WinClass);
Handle := CreateWindowEx(0, 'TAPIxForm', 'Form',
WS_POPUP or WS_GROUP or
WS_MINIMIZEBOX or WS_MAXIMIZEBOX or WS_SYSMENU or WS_EX_CLIENTEDGE,
219, 116, 500, 366,
0, 0,
Form, nil);
ShowWindow(Handle, SW_SHOW);
hFont := CreateFont(
-11, 0, 0, 0, 0, 0, 0, 0,
DEFAULT_CHARSET,
OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY,
DEFAULT_PITCH or FF_DONTCARE, 'MS Sans Serif');
Button1 := CreateWindow(
'Button',
'',
WS_CHILD or BS_TEXT or WS_VISIBLE,
334, 16, 19, 17, Handle, Button1, Form, nil);
SendMessage(Button1, WM_SETFONT, hFont, 0);