Skip to content
Browse files

added project Autostartdemo and SelfKillingControls

  • Loading branch information...
1 parent 2c49b6e commit 737617e464c81b68b9399584fa57aa706362a25a @sx2008 committed Apr 17, 2012
View
80 AutostartDemo/Autostartdemo.dof
@@ -0,0 +1,80 @@
+[Compiler]
+A=1
+B=0
+C=1
+D=1
+E=0
+F=0
+G=1
+H=1
+I=1
+J=1
+K=0
+L=1
+M=0
+N=1
+O=1
+P=1
+Q=0
+R=0
+S=0
+T=0
+U=0
+V=1
+W=0
+X=1
+Y=1
+Z=1
+ShowHints=1
+ShowWarnings=1
+UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
+[Linker]
+MapFile=0
+OutputObjs=0
+ConsoleApp=1
+DebugInfo=0
+RemoteSymbols=0
+MinStackSize=16384
+MaxStackSize=1048576
+ImageBase=4194304
+ExeDescription=Internet Explorer 5.5 Components
+[Directories]
+OutputDir=
+UnitOutputDir=
+PackageDLLOutputDir=
+PackageDCPOutputDir=
+SearchPath=
+Packages=Vcl50;Vclx50;VclSmp50;Vclbde50;Vcldb50;vcldbx50;TeeUI50;TeeDB50;Tee50;TeeQR50;VCLIB50;vclie50;Inetdb50;Inet50;NMFast50;dclocx50;dclaxserver50;vclado50;rbTDBC51;rbRCL55;rbCIDE55;rbIDE55;rbBDE55;rbRIDE55;rbRAP55;rbDBDE55;rbDAD55;rbDIDE55;rbUSER55;rbDB55;rbADO55;rbIBE55;BIZPACK;RxCtl5;RxDB5;RxBDE5;BuilderControlsPackageDesign;BuilderControlsPackage;DfueVersPack;DJCL50
+Conditionals=
+DebugSourceDirs=
+UsePackages=0
+[Parameters]
+RunParams=13000
+HostApplication=
+[Version Info]
+IncludeVerInfo=0
+AutoIncBuild=0
+MajorVer=1
+MinorVer=0
+Release=0
+Build=0
+Debug=0
+PreRelease=0
+Special=0
+Private=0
+DLL=0
+Locale=1031
+CodePage=1252
+[Version Info Keys]
+CompanyName=
+FileDescription=
+FileVersion=1.0.0.0
+InternalName=
+LegalCopyright=
+LegalTrademarks=
+OriginalFilename=
+ProductName=
+ProductVersion=1.0.0.0
+Comments=
+[Excluded Packages]
+$(DELPHI)\Bin\dclite50.bpl=Borland Integrierte �bersetzungsumgebung (ITE)
View
13 AutostartDemo/Autostartdemo.dpr
@@ -0,0 +1,13 @@
+program Autostartdemo;
+
+uses
+ Forms,
+ Unit2 in 'Unit2.pas' {Form1};
+
+{$R *.RES}
+
+begin
+ Application.Initialize;
+ Application.CreateForm(TForm1, Form1);
+ Application.Run;
+end.
View
35 AutostartDemo/Unit2.dfm
@@ -0,0 +1,35 @@
+object Form1: TForm1
+ Left = 318
+ Top = 271
+ Width = 269
+ Height = 96
+ Caption = 'Autostart Demo'
+ Color = clBtnFace
+ Font.Charset = DEFAULT_CHARSET
+ Font.Color = clWindowText
+ Font.Height = -11
+ Font.Name = 'MS Sans Serif'
+ Font.Style = []
+ OldCreateOrder = False
+ OnCreate = FormCreate
+ PixelsPerInch = 96
+ TextHeight = 13
+ object Gauge1: TGauge
+ Left = 0
+ Top = 41
+ Width = 261
+ Height = 28
+ Align = alClient
+ Progress = 0
+ end
+ object Panel1: TPanel
+ Left = 0
+ Top = 0
+ Width = 261
+ Height = 41
+ Align = alTop
+ Caption = 'Panel1'
+ TabOrder = 0
+ OnClick = Panel1Click
+ end
+end
View
102 AutostartDemo/Unit2.pas
@@ -0,0 +1,102 @@
+unit Unit2;
+{
+folgendes Demo Programm zeigt, wie man mit einer selbst definierten Windows-Message
+eine Funktion automatisch starten kann ohne eine Timer zu verwenden
+}
+
+
+interface
+
+uses
+ Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
+ ExtCtrls, Gauges;
+
+const
+ WM_AUTOSTART = WM_USER+ 67; // User defined windows message
+
+type
+ TForm1 = class(TForm)
+ Panel1: TPanel;
+ Gauge1: TGauge;
+ procedure Panel1Click(Sender: TObject);
+ procedure FormCreate(Sender: TObject);
+ private
+ { Private-Deklarationen }
+ procedure WMAutostart(var msg:TMessage); message WM_AUTOSTART;
+ public
+ { Public-Deklarationen }
+ procedure DoWork;
+ end;
+
+var
+ Form1: TForm1;
+
+implementation
+
+{$R *.DFM}
+
+
+procedure SimulateMouseclick(control : TWinControl);
+var
+ Wnd: HWND;
+ P: TPoint;
+ Rect: TRect;
+begin
+ Wnd := control.Handle;
+ if Wnd <> 0 then
+ begin
+ Windows.GetClientRect(Wnd, Rect);
+ P.X := (Rect.Left + Rect.Right) div 2;
+ P.Y := (Rect.Top + Rect.Bottom) div 2;
+ PostMessage(Wnd, WM_LBUTTONDOWN, 0, MakeLParam(P.X, P.Y));
+ PostMessage(Wnd, WM_LBUTTONUP, 0, MakeLParam(P.X, P.Y));
+ end;
+end;
+
+
+
+
+procedure TForm1.DoWork;
+var
+ i : Integer;
+begin
+ Panel1.Caption := ParamStr(1);
+
+ Gauge1.MaxValue := StrToInt(ParamStr(1));
+
+ for i := Gauge1.MinValue to Gauge1.MaxValue do
+ begin
+ Gauge1.Progress := i;
+ Application.ProcessMessages;
+ if Application.Terminated then
+ Break;
+ Sleep(2);
+ end;
+end;
+
+procedure TForm1.Panel1Click(Sender: TObject);
+begin
+ DoWork;
+end;
+
+procedure TForm1.FormCreate(Sender: TObject);
+begin
+ if ParamCount = 1 then
+ begin
+ PostMessage(Self.Handle, WM_AUTOSTART, 0, 0);
+
+// SimulateMouseclick(Panel1);
+ end;
+end;
+
+procedure TForm1.WMAutostart(var msg: TMessage);
+begin
+ DoWork;
+ msg.Result := 1;
+end;
+
+
+
+
+
+end.
View
80 SelfKillingControls/SelfKillingControls.dof
@@ -0,0 +1,80 @@
+[Compiler]
+A=1
+B=0
+C=1
+D=1
+E=0
+F=0
+G=1
+H=1
+I=1
+J=1
+K=0
+L=1
+M=0
+N=1
+O=1
+P=1
+Q=0
+R=0
+S=0
+T=0
+U=0
+V=1
+W=0
+X=1
+Y=1
+Z=1
+ShowHints=1
+ShowWarnings=1
+UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
+[Linker]
+MapFile=0
+OutputObjs=0
+ConsoleApp=1
+DebugInfo=0
+RemoteSymbols=0
+MinStackSize=16384
+MaxStackSize=1048576
+ImageBase=4194304
+ExeDescription=Internet Explorer 5.5 Components
+[Directories]
+OutputDir=
+UnitOutputDir=
+PackageDLLOutputDir=
+PackageDCPOutputDir=
+SearchPath=
+Packages=Vcl50;Vclx50;VclSmp50;Vclbde50;Vcldb50;vcldbx50;TeeUI50;TeeDB50;Tee50;TeeQR50;VCLIB50;vclie50;Inetdb50;Inet50;NMFast50;dclocx50;dclaxserver50;vclado50;rbTDBC51;rbRCL55;rbCIDE55;rbIDE55;rbBDE55;rbRIDE55;rbRAP55;rbDBDE55;rbDAD55;rbDIDE55;rbUSER55;rbDB55;rbADO55;rbIBE55;BIZPACK;RxCtl5;RxDB5;RxBDE5;BuilderControlsPackageDesign;BuilderControlsPackage;DfueVersPack;DJCL50
+Conditionals=
+DebugSourceDirs=
+UsePackages=0
+[Parameters]
+RunParams=
+HostApplication=
+[Version Info]
+IncludeVerInfo=0
+AutoIncBuild=0
+MajorVer=1
+MinorVer=0
+Release=0
+Build=0
+Debug=0
+PreRelease=0
+Special=0
+Private=0
+DLL=0
+Locale=1031
+CodePage=1252
+[Version Info Keys]
+CompanyName=
+FileDescription=
+FileVersion=1.0.0.0
+InternalName=
+LegalCopyright=
+LegalTrademarks=
+OriginalFilename=
+ProductName=
+ProductVersion=1.0.0.0
+Comments=
+[Excluded Packages]
+$(DELPHI)\Bin\dclite50.bpl=Borland Integrierte �bersetzungsumgebung (ITE)
View
13 SelfKillingControls/SelfKillingControls.dpr
@@ -0,0 +1,13 @@
+program SelfKillingControls;
+
+uses
+ Forms,
+ Unit1 in 'Unit1.pas' {Form1};
+
+{$R *.RES}
+
+begin
+ Application.Initialize;
+ Application.CreateForm(TForm1, Form1);
+ Application.Run;
+end.
View
46 SelfKillingControls/Unit1.dfm
@@ -0,0 +1,46 @@
+object Form1: TForm1
+ Left = 440
+ Top = 193
+ Width = 247
+ Height = 155
+ ActiveControl = Button1
+ Caption = 'Self destroying Controls'
+ Color = clBtnFace
+ Font.Charset = DEFAULT_CHARSET
+ Font.Color = clWindowText
+ Font.Height = -11
+ Font.Name = 'MS Sans Serif'
+ Font.Style = []
+ OldCreateOrder = False
+ PixelsPerInch = 96
+ TextHeight = 13
+ object Button1: TButton
+ Left = 16
+ Top = 24
+ Width = 177
+ Height = 25
+ Caption = 'Click Me -> kills me'
+ TabOrder = 0
+ OnClick = Button1Click
+ OnKeyDown = Button1KeyDown
+ end
+ object Edit1: TEdit
+ Left = 16
+ Top = 64
+ Width = 209
+ Height = 21
+ TabOrder = 1
+ Text = 'I want to die ! Press Crtl-Delete to kill me'
+ OnKeyDown = Button1KeyDown
+ end
+ object CheckBox1: TCheckBox
+ Left = 16
+ Top = 96
+ Width = 177
+ Height = 17
+ Caption = 'Pleeeease, don'#39't check me'
+ TabOrder = 2
+ OnClick = Button1Click
+ OnKeyDown = Button1KeyDown
+ end
+end
View
62 SelfKillingControls/Unit1.pas
@@ -0,0 +1,62 @@
+unit Unit1;
+
+interface
+
+uses
+ Windows, Messages, Classes, Graphics, Controls, Forms, StdCtrls;
+
+const
+ WM_KILL_CONTROL = WM_USER+ 66;
+
+type
+ TForm1 = class(TForm)
+ Button1: TButton;
+ Edit1: TEdit;
+ CheckBox1: TCheckBox;
+ procedure Button1Click(Sender: TObject);
+ procedure Button1KeyDown(Sender: TObject; var Key: Word;
+ Shift: TShiftState);
+ private
+ { Private-Deklarationen }
+ procedure WMKillControl(var msg:TMessage); message WM_KILL_CONTROL;
+
+ public
+ { Public-Deklarationen }
+ end;
+
+var
+ Form1: TForm1;
+
+implementation
+
+{$R *.DFM}
+
+procedure TForm1.WMKillControl(var msg: TMessage);
+var
+ c : TControl;
+begin
+ c := TControl(msg.LParam);
+ if not Assigned(c) then
+ Exit;
+
+ c.Free;
+ windows.MessageBeep($FFFFFFFF);
+end;
+
+procedure TForm1.Button1Click(Sender: TObject);
+begin
+// Sender.Free; // würde meistens eine Exception auslösen
+ PostMessage(Self.Handle, WM_KILL_CONTROL, 0, Integer(Sender));
+end;
+
+procedure TForm1.Button1KeyDown(Sender: TObject; var Key: Word;
+ Shift: TShiftState);
+begin
+ if (Key=VK_DELETE) and (Shift=[ssCtrl]) then
+ begin
+ // Sender.Free; // würde meistens eine Exception auslösen
+ PostMessage(Self.Handle, WM_KILL_CONTROL, 0, Integer(Sender));
+ end;
+end;
+
+end.

0 comments on commit 737617e

Please sign in to comment.
Something went wrong with that request. Please try again.