 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
malfunction Grandmaster Cheater Supreme
Reputation: 0
Joined: 30 Jan 2007 Posts: 1015 Location: http://www.behindthecorner.com/
|
Posted: Mon Feb 25, 2008 1:18 pm Post subject: [DELPHI] Codes Related to Forms |
|
|
Basic Codes Related to Forms
here are some codes which you can use in your forms
Minimize to System Tray
| Code: | unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ShellApi;
const
WM_NOTIFYICON = WM_USER+333;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
tnid: TNotifyIconData;
HMainIcon: HICON;
procedure CMClickIcon(var msg: TMessage); message WM_NOTIFYICON;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.CMClickIcon(var msg: TMessage);
begin
case msg.lparam of
WM_LBUTTONDBLCLK : Show;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
HMainIcon := LoadIcon(MainInstance, 'MAINICON');
Shell_NotifyIcon(NIM_DELETE, @tnid);
tnid.cbSize := sizeof(TNotifyIconData);
tnid.Wnd := handle;
tnid.uID := 123;
tnid.uFlags := NIF_MESSAGE or NIF_ICON or NIF_TIP;
tnid.uCallbackMessage := WM_NOTIFYICON;
tnid.hIcon := HMainIcon;
tnid.szTip := 'POP3 Server';
Shell_NotifyIcon(NIM_ADD, @tnid);
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action := caNone;
Hide;
end;
end. |
Create a gradient filled form
| Code: | procedure TForm1.FormPaint(Sender: TObject);
var
Row, Ht: Word;
begin
Ht:=(ClientHeight+255) div 256;
for Row:=0 to 255 do
with Canvas do
begin
Brush.Color:=RGB(Row,0,0);
FillRect(Rect(0,Row*Ht,ClientWidth,(Row+1)*Ht));
end;
end; |
Use image as backgroung of a form
| Code: | procedure TForm1.FormCreate(Sender: TObject);
var
MyBitmap: TBitmap;
begin
MyBitmap:=TBitmap.Create;
MyBitmap.LoadFromFile('bg.bmp');
Form1.Brush.Bitmap:=MyBitmap;
end; |
Create a transparent Tform
| Code: | private
{ Private declarations }
FullRgn, ClientRgn, CtlRgn: THandle;
procedure MakeTransparent;
procedure UndoTransparent;
end;
{...}
implementation
{...}
procedure TForm1.MakeTransparent;
var
AControl: TControl;
A, Margin, X, Y, CtlX, CtlY: Integer;
begin
Margin := (Width - ClientWidth) div 2;
FullRgn := CreateRectRgn(0, 0, Width, Height);
X := Margin;
Y := Height - ClientHeight - Margin;
ClientRgn := CreateRectRgn(X, Y, X + ClientWidth, Y + ClientHeight);
CombineRgn(FullRgn, FullRgn, ClientRgn, RGN_DIFF);
for A := 0 to ControlCount - 1 do
begin
AControl := Controls[A];
if (AControl is TWinControl) or (AControl is TGraphicControl) then with AControl do
begin
if Visible then
begin
CtlX := X + Left;
CtlY := Y + Top;
CtlRgn := CreateRectRgn(CtlX, CtlY, CtlX + Width, CtlY + Height);
CombineRgn(FullRgn, FullRgn, CtlRgn, RGN_OR);
end;
end;
end;
SetWindowRgn(Handle, FullRgn, True);
end;
procedure TForm1.UndoTransparent;
begin
FullRgn := CreateRectRgn(0, 0, Width, Height);
CombineRgn(FullRgn, FullRgn, FullRgn, RGN_COPY);
SetWindowRgn(Handle, FullRgn, True);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
MakeTransparent
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
UndoTransparent
end; |
Show hints in the Statusbar
| Code: | private
procedure MyHint(Sender: TObject);
end;
implementation
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnHint := MyHint;
ShowHint := True;
Button1.Hint := 'normal yellow hint|Text in Statusbar';
Button2.Hint := 'only yellow hint|';
Button3.Hint := '|text only in statusbar';
Edit1.Hint := 'same text';
end;
procedure TForm1.MyHint(Sender: TObject);
begin
StatusBar1.SimpleText := Application.Hint;
end; |
Prevent a Form from Moving or Resizing
| Code: | private
procedure WMSysCommand(var Msg: TWMSysCommand); message WM_SYSCOMMAND;
implementation
procedure TForm1.WMSysCommand(var Msg: TWMSysCommand);
begin
if ((Msg.CmdType and $FFF0) = SC_MOVE) or
((Msg.CmdType and $FFF0) = SC_SIZE) then
begin
Msg.Result := 0;
Exit;
end;
inherited;
end; |
_________________
|
|
| Back to top |
|
 |
HolyBlah Master Cheater
Reputation: 2
Joined: 24 Aug 2007 Posts: 446
|
|
| Back to top |
|
 |
DeletedUser14087 I post too much
Reputation: 2
Joined: 21 Jun 2006 Posts: 3069
|
Posted: Mon Feb 25, 2008 4:19 pm Post subject: |
|
|
| lol HolyBlah have to chase your posts.
|
|
| Back to top |
|
 |
Snootae Grandmaster Cheater
Reputation: 0
Joined: 16 Dec 2006 Posts: 969 Location: --->
|
Posted: Tue Feb 26, 2008 6:11 am Post subject: |
|
|
theres not much chasing to be done, type 3 word in google and your there
_________________
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Tue Feb 26, 2008 11:47 pm Post subject: |
|
|
| Rot1 wrote: | | lol HolyBlah have to chase your posts. |
You are one to talk, Kasper.
Locking this to prevent flaming as the OP has spammed the section with code he is claiming he wrote that has been clearly found elsewhere.
_________________
- Retired. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|