program mbutton;
{$W-,K+}
{$R mbutton}
{$C MOVEABLE PRELOAD PERMANENT} {gleiche Attribute wie Unit SYSTEM}
{$D Mittlere Maustaste mit Doppelklick}
uses WinProcs,WinTypes,Win31;
function DialogProc(Wnd:HWnd; Msg,wParam:Word; lParam:LongInt):Bool; export;
begin
DialogProc:=false;
case Msg of
WM_InitDialog: begin
Msg:=GetSystemMenu(Wnd,false);
DeleteMenu(Msg,SC_Maximize,MF_ByCommand);
DeleteMenu(Msg,SC_Size,MF_ByCommand);
InsertMenu(Msg,0,MF_ByPosition or MF_String,23,'Verb&ergen');
ShowWindow(Wnd,CmdShow);
if lstrcmpi(CmdLine,'/hidden')=0
then PostMessage(Wnd,WM_SysCommand,23,0);
DialogProc:=true;
end;
WM_Command: case wParam of
ID_OK,ID_Cancel: EndDialog(Wnd,0);
end;
WM_SysCommand: if wParam=23 then ShowWindow(Wnd,SW_Hide);
end;
end;
const
wc:TWndClass=(
style: CS_VRedraw or CS_HRedraw;
lpfnWndProc: @DefDlgProc;
cbClsExtra: 0;
cbWndExtra: DlgWindowExtra;
hInstance: Seg(HInstance);
hIcon: 0;
hCursor: 0;
hbrBackground:Color_Background+1;
lpszMenuName: nil;
lpszClassName:'MBUTTON');
var
MButDll: THandle;
begin
if HPrevInst<>0 then begin {Nicht doppelt starten!}
wc.hIcon:=FindWindow(wc.lpszClassName,nil);
if ShowWindow(wc.hIcon,SW_Restore)
then SetActiveWindow(wc.hIcon);
halt(221);
end;
wc.hIcon:=LoadIcon(Seg(HInstance),MakeIntResource(100));
wc.hCursor:=LoadCursor(0,IDC_Arrow);
RegisterClass(wc);
MButDll:=LoadLibrary('MBUTDLL.DLL');
if lstrcmpi(CmdLine,'/load')=0 then halt; {kein Dialog!}
DialogBox(hInstance,MakeIntResource(100),0,@DialogProc);
FreeLibrary(MButDll);
DestroyIcon(wc.hIcon);
end.
Detected encoding: ASCII (7 bit) | 2
|