 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
h4c0r-BG Master Cheater
Reputation: 0
Joined: 29 Nov 2006 Posts: 449 Location: The yogurt country
|
Posted: Sun Dec 21, 2008 11:08 am Post subject: [Delphi] DLL which changes the title of process |
|
|
Well I am trying to do a simple dll which:
•When i inject the dll in the process, the dll changes the application title.
I am doing the following:
| Quote: | library Project2;
uses
Windows,
SysUtils,
Classes;
{$R *.res}
var
myhandle:thandle;
begin
myhandle:=0;
myhandle:=GetCurrentProcess;
if myhandle<>0 then
begin
Messagebox(0,'Click OK to change the title of the application','',0);
SetWindowText(myhandle,'MYNEWTITLEISHERE');
end;
end. |
But it does not work => the title just does not change at all ... but I see the message box, since the value is different than 0 and seems that "i have the handle".
_________________
Last edited by h4c0r-BG on Sun Dec 21, 2008 11:10 am; edited 1 time in total |
|
| Back to top |
|
 |
smartz993 I post too much
Reputation: 2
Joined: 20 Jun 2006 Posts: 2013 Location: USA
|
Posted: Sun Dec 21, 2008 11:10 am Post subject: |
|
|
| Code: | BOOL SetWindowText(
HWND hWnd,
LPCTSTR lpString
); |
SetWindowText takes a handle to the window, aka hWnd.
A handle to the window is different than a handle to your process, which is obtained from GetCurrentProcess.
Use the FindWindow API to get a handle to the window.
| Code: | HWND FindWindow(
LPCTSTR lpClassName,
LPCTSTR lpWindowName
); |
Example:
| Code: | | SetWindowText(FindWindow(0,'MyWindowName'),'NewWindowName!'); |
Or in yours...
| Quote: | library Project2;
uses
Windows,
SysUtils,
Classes;
{$R *.res}
var
myhandle:thandle;
begin
myhandle:=0;
myhandle:=FindWindow(0,'WindowName');
if myhandle<>0 then
begin
Messagebox(0,'Click OK to change the title of the application','',0);
SetWindowText(myhandle,'MYNEWTITLEISHERE');
end;
end. |
Last edited by smartz993 on Sun Dec 21, 2008 11:14 am; edited 1 time in total |
|
| Back to top |
|
 |
h4c0r-BG Master Cheater
Reputation: 0
Joined: 29 Nov 2006 Posts: 449 Location: The yogurt country
|
Posted: Sun Dec 21, 2008 11:13 am Post subject: |
|
|
Solved. Thank you very much.
_________________
|
|
| 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
|
|