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 


How do you attach to window???

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Fri Nov 23, 2007 5:39 pm    Post subject: How do you attach to window??? Reply with quote

I dont get it...
When I use GetForeGroundWindow It works and keys are sent. But when I use GetWIndow it it doesn't get it...
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Fri Nov 23, 2007 8:50 pm    Post subject: Reply with quote

If GetForegroundWindow is working fine then whats the problem?

Also you are probably using the API wrong:


GetWindow:
The GetWindow function retrieves a handle to a window that has the specified relationship (Z-Order or owner) to the specified window.


GetForegroundWindow:
The GetForegroundWindow function returns a handle to the foreground window (the window with which the user is currently working). The system assigns a slightly higher priority to the thread that creates the foreground window than it does to other threads.


If you need to "attach" to the process for its handle use OpenProcess. You can locate the process ID a number of ways, the easier one being the use of CreateToolhelp32Snapshot using Process32First / Process32Next. There are a few examples already posted on the forums that you can look for.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
ZenX
Grandmaster Cheater Supreme
Reputation: 1

Joined: 26 May 2007
Posts: 1021
Location: ">>Pointer<<" : Address 00400560 Offset :1FE

PostPosted: Fri Nov 23, 2007 10:09 pm    Post subject: Reply with quote

Depends on the language.
_________________
CEF Moderator since 2007 ^_^
ZenX-Engine
Back to top
View user's profile Send private message Yahoo Messenger
Blagg
How do I cheat?
Reputation: 0

Joined: 13 Jul 2007
Posts: 4

PostPosted: Sat Nov 24, 2007 3:22 am    Post subject: for c++ wind Reply with quote

Not sure ur lang but here is how i get a window when i create a trainer in c++ Surprised

HWND hwnd;
HANDLE phandle;
DWORD pid;
hwnd = FindWindow(NULL,"Window Name");
if (hwnd != 0)
{
GetWindowThreadProcessId(hwnd,&pid);
phandle = OpenProcess(PROCESS_ALL_ACCESS,0,pid);
} else {
cout << " No way Jose!"<<endl;
}
if (phandle != 0)
{
// your stuff when you have the pid and handle to window !!! XD
}
else
{
cout << " Sigh...."<<endl;
}
}
// just void main and make the above a function your set
// btw this is for everyone........You can WriteProcessMemory after these
// steps
// good info here Smile
Embarassed
Back to top
View user's profile Send private message
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Sat Nov 24, 2007 6:12 pm    Post subject: Reply with quote

Language is Delphi 7...
I ment for sendkeys or the dispatch method. It doesn't work for some reason...
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: Sat Nov 24, 2007 7:07 pm    Post subject: Reply with quote

Make a call to user32.dll and set the focus to the window.

I don't know the Delphi code for importing functions, so I can't help you there.

_________________
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
HolyBlah
Master Cheater
Reputation: 2

Joined: 24 Aug 2007
Posts: 446

PostPosted: Sun Nov 25, 2007 4:54 am    Post subject: Reply with quote

In delphi there is a unit called SndKey32.
You Can use it this way:
Code:
procedure TForm1.SendKeyStroksClick(Sender: TObject);
begin
AppActivate('Untitled - Notepad') ;
sleep(1000);
SendKeys('Blah Rulz!', True) ;
end;

Remember to include SndKey32 in your uses lust and if the compiler doesn't find it here is the the file: Link
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