Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[Release] Delphi process locker

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Snootae
Grandmaster Cheater
Reputation: 0

Joined: 16 Dec 2006
Posts: 969
Location: --->

PostPosted: Sun Apr 13, 2008 9:52 am    Post subject: [Release] Delphi process locker Reply with quote

hey guys, this is a little proggy i've been working on since an hour ago, handy for pissing people off

basically you set the window title of a program, and if that window title exists, it closes it (may not be able to close all programs), i've also added some options to hide the program a bit, i could hide the process, but i dont know how you could close it (maybe some crazy hotkeys Razz )

i have called it processlocker, but if you wanted to annoy someone name it something that sounds important, so they wont "end process" it

Instructions:
1. Type in window title for program you want not to be able to open
2. Click Lock button
3. Click hide button
4. Watch someone get pissed off

this is fairly basic, but someone might find it handy (or fun Razz )

thanks to Moller


I've attached both the delphi project, made in turbo delphi 2006, and the .exe

Code:
Code:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, TlHelp32, StdCtrls, ExtCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Edit1: TEdit;
    Timer1: TTimer;
    Button2: TButton;
    procedure Click(Sender: TObject);
    procedure BtnLockClick(Sender: TObject);
    procedure TmrCheckTimer(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure BtnHideClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  Locked: Boolean;
  WindowTitle: String;
  h: HWND;

implementation

{$R *.dfm}

procedure TForm1.BtnLockClick(Sender: TObject);
begin

if locked = false then
begin

WindowTitle := Edit1.text;
Edit1.Enabled := false;
Button1.Caption := 'Unlock!';

//Change textbox so it can't be edited
locked := true;

//Start timer to check if the window exists
Timer1.Enabled := true;

//Exit procedure to avoid looping
Exit;
end;

if locked = true then
begin
locked := false;
Edit1.Enabled := true;
Button1.Caption := 'Lock!';
Timer1.Enabled := false;
Exit;
end;
end;

procedure TForm1.BtnHideClick(Sender: TObject);
begin
   //Hide program from taskbar
   ShowWindow(Application.Handle, SW_HIDE) ;
   SetWindowLong(Application.Handle, GWL_EXSTYLE,
   getWindowLong(Application.Handle, GWL_EXSTYLE) or
   WS_EX_TOOLWINDOW) ;
   ShowWindow(Application.Handle, SW_SHOW) ;

   //Hide main form
   Form1.Visible := false;
end;

procedure TForm1.Click(Sender: TObject);
begin
//Remove default text
if Edit1.text = 'Window Title e.g.    Untitled - Notepad' then
   Edit1.text := '';
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
//Program is unlock on creation
locked := false;
end;

procedure TForm1.TmrCheckTimer(Sender: TObject);
begin
//Check if program with specified window title exists
h := FindWindow(nil, PChar(WindowTitle));
if h <> 0 then PostMessage(h, WM_CLOSE, 0, 0); //Closes program with specified title
end;

end.


hope you guys learn a little bit from this



The Extension 'rar' was deactivated by an board admin, therefore this Attachment is not displayed.


The Extension 'rar' was deactivated by an board admin, therefore this Attachment is not displayed.


_________________


Last edited by Snootae on Wed Apr 16, 2008 9:10 pm; edited 1 time in total
Back to top
View user's profile Send private message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Sun Apr 13, 2008 10:06 am    Post subject: Reply with quote

hahah i did something like this in C# Razz Sent it to my friend and it raped her msn and internet, i quickly got a phone call haha Very Happy
_________________
Back to top
View user's profile Send private message
DeletedUser14087
I post too much
Reputation: 2

Joined: 21 Jun 2006
Posts: 3069

PostPosted: Sun Apr 13, 2008 10:33 am    Post subject: Reply with quote

Why did you PChar 2nd param in FindWindow() ?
Back to top
View user's profile Send private message
DoomsDay
Grandmaster Cheater
Reputation: 0

Joined: 06 Jan 2007
Posts: 768
Location: %HomePath%

PostPosted: Sun Apr 13, 2008 12:11 pm    Post subject: Reply with quote

Rot1 wrote:
Why did you PChar 2nd param in FindWindow() ?
PChar points to a char(also array), it's basicly a pointer to a null terminated string. WinAPI's require pointers.
Back to top
View user's profile Send private message
rapion124
Grandmaster Cheater Supreme
Reputation: 0

Joined: 25 Mar 2007
Posts: 1095

PostPosted: Sun Apr 13, 2008 6:57 pm    Post subject: Reply with quote

You don't need PChars. You can simply declare a variable as a string and add a "@" in front of it in the call.
Back to top
View user's profile Send private message
Snootae
Grandmaster Cheater
Reputation: 0

Joined: 16 Dec 2006
Posts: 969
Location: --->

PostPosted: Sun Apr 13, 2008 8:51 pm    Post subject: Reply with quote

ahh, i did not know that
_________________
Back to top
View user's profile Send private message
DeletedUser14087
I post too much
Reputation: 2

Joined: 21 Jun 2006
Posts: 3069

PostPosted: Mon Apr 14, 2008 1:00 am    Post subject: Reply with quote

it's PAnsiChar ffs, why did he PChar it ?

he could just initialize a PAnsiChar variable and use it on FindWindow();

P = ^ (Pointer)

For example, PChar = ^Char. a Pointer Char.

like in C it's char *name if i'm correct.

so he didn't had to though.

rapion124 wrote:
You don't need PChars. You can simply declare a variable as a string and add a "@" in front of it in the call.


Wouldn't @ directly jump to the varialbe address ?
Back to top
View user's profile Send private message
Snootae
Grandmaster Cheater
Reputation: 0

Joined: 16 Dec 2006
Posts: 969
Location: --->

PostPosted: Mon Apr 14, 2008 1:57 am    Post subject: Reply with quote

ok rot1, calm down, but it works, i dont know why, but it does

that's how i learn

_________________
Back to top
View user's profile Send private message
DeletedUser14087
I post too much
Reputation: 2

Joined: 21 Jun 2006
Posts: 3069

PostPosted: Mon Apr 14, 2008 5:22 am    Post subject: Reply with quote

Snootae wrote:
ok rot1, calm down, but it works, i dont know why, but it does

that's how i learn


i'm calmed, you can use PCHar() if you want, i'm just saying that if you declare a string, and you wanna use it on a function that one of its param are PAnsiChar, then do it like

s:string;
s:='hey';
FindWindow(PChar(s),nil)

use PChar, i don't mind i'm just saying.
Back to top
View user's profile Send private message
Anden100
Grandmaster Cheater
Reputation: 0

Joined: 20 Apr 2007
Posts: 668

PostPosted: Mon Apr 14, 2008 5:35 am    Post subject: Reply with quote

Rot1 wrote:
it's PAnsiChar ffs, why did he PChar it ?

he could just initialize a PAnsiChar variable and use it on FindWindow();

P = ^ (Pointer)

For example, PChar = ^Char. a Pointer Char.

like in C it's char *name if i'm correct.

so he didn't had to though.

rapion124 wrote:
You don't need PChars. You can simply declare a variable as a string and add a "@" in front of it in the call.


Wouldn't @ directly jump to the varialbe address ?


Omg Rot1, i just found out what PChar was Razz, well ty for that explination Razz
Back to top
View user's profile Send private message
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Wed Apr 16, 2008 2:21 pm    Post subject: Reply with quote

You should learn to name your buttons.

I started to read it, but I stopped about a quarter of the way through because I didn't know what the text of all the buttons was.

_________________
Wiccaan wrote:

Oh jeez, watchout I'm a bias person! Locked.


Auto Assembly Tuts:
In Depth Tutorial on AA
Extended
Back to top
View user's profile Send private message
Anden100
Grandmaster Cheater
Reputation: 0

Joined: 20 Apr 2007
Posts: 668

PostPosted: Wed Apr 16, 2008 2:45 pm    Post subject: Reply with quote

samuri25404 wrote:
You should learn to name your buttons.

I started to read it, but I stopped about a quarter of the way through because I didn't know what the text of all the buttons was.


I know what you mean... this source isnt that big, but when i start to code applications, like bots and such, i ALWAYS get confused at the names of the objects..., i have to click each and every of them, every time i need to use them! Razz, this is where it comes in handy to give the objects names O.o!
Back to top
View user's profile Send private message
Snootae
Grandmaster Cheater
Reputation: 0

Joined: 16 Dec 2006
Posts: 969
Location: --->

PostPosted: Wed Apr 16, 2008 9:07 pm    Post subject: Reply with quote

oh yeh, i forgot about that, i usually dont bother if i only have a few buttons, i'll fix it though, should have done it before i released, sorry

Edit: changed names, hope its easier to understand

P.s. samurai, there's mistake in your signarture:

Quote:
Proud Programmer and Writer:
Programmer of
Opcode-AOB Converter


sorry, im just being picky

_________________
Back to top
View user's profile Send private message
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Thu Apr 17, 2008 7:18 pm    Post subject: Reply with quote

Snootae wrote:
oh yeh, i forgot about that, i usually dont bother if i only have a few buttons, i'll fix it though, should have done it before i released, sorry

Edit: changed names, hope its easier to understand

P.s. samurai, there's mistake in your signarture:

Quote:
Proud Programmer and Writer:
Programmer of
Opcode-AOB Converter


sorry, im just being picky


Yes, it's much easier to read now. Wink

and I'm not quite sure what you're getting at by my signature? Are you talking about the capitalization?

Edit:

So it just closes the application? o_O

_________________
Wiccaan wrote:

Oh jeez, watchout I'm a bias person! Locked.


Auto Assembly Tuts:
In Depth Tutorial on AA
Extended
Back to top
View user's profile Send private message
Snootae
Grandmaster Cheater
Reputation: 0

Joined: 16 Dec 2006
Posts: 969
Location: --->

PostPosted: Thu Apr 17, 2008 7:25 pm    Post subject: Reply with quote

yeah essentially

and with your sig: it's just a bit confusing, you finish your first line with a ':', but then list them under another catergory, your first line should be a statement and then the"programmer of :" and "writer of :"

_________________
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites