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 


[C++] Window not recieving?

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

Joined: 16 Jun 2006
Posts: 551

PostPosted: Sat Jul 04, 2009 4:03 pm    Post subject: [C++] Window not recieving? Reply with quote

I'll keep this short.

When you type "hidden test" in Pinball, you can move the ball with your mouse.

I'm making a trainer to get a feel for basic memory editing and wanted to add this as an extra feature.

How can I simulate typing hidden test in pinball with c++?

I have already tried:

Code:
char* SendText = "hidden test";

for( int i = 0; i <= strlen( SendText ); i++ )
PostMessage( HWND, WM_CHAR, SendText[i], 0 );


Code:
PostMessage(hWnd, WM_KEYDOWN, 0, 0x48); //h down 
PostMessage(hWnd, WM_KEYUP, 0, 0x48);   //h up
//used this to type out all the other letters too


Code:
SendMessage(hWnd, WMCHAR, 0 , (long)"hidden test");
//might have typed this wrong..forgot the exact parameter order but you get the idea


Code:
SendString(hWnd, TEXT("hidden test"), 50);

//(This is Irwin's function)
VOID SendString(__in HWND hWnd, __in_z LPCTSTR lpcszMessage, __in_opt UINT uSleep = 0)
{
  for (int i = 0; i < lstrlen(lpcszMessage); i++, Sleep(uSleep))
   SendMessage(hWnd, WM_CHAR, lpcszMessage[i], 0);
}


Running out of idea here. Can I get some input?

_________________
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Sat Jul 04, 2009 4:27 pm    Post subject: Reply with quote

Or you can just do it the easy way and find the address in about 4 seconds.
Back to top
View user's profile Send private message
manc
Grandmaster Cheater
Reputation: 1

Joined: 16 Jun 2006
Posts: 551

PostPosted: Sat Jul 04, 2009 5:07 pm    Post subject: Reply with quote

O mighty slovach, how might I do that? Confused

I can find addresses that have logic behind them...like ammo, hp, etc.
But how would I find it?

You can't turn it off without closing the game, so I don't know how to narrow down the addresses in this case.

_________________
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Sat Jul 04, 2009 5:16 pm    Post subject: Reply with quote

I'm pretty sure you can disable it if I remember right?

This is also why you have the other search functions in CE. Search unknown, search changed, etc, etc.


Anyway, it's probably just a simple disabled, enabled deal (0 and 1 respectively).
Back to top
View user's profile Send private message
Cheat Engine User
Something epic
Ban
Reputation: 60

Joined: 22 Jun 2007
Posts: 2071

PostPosted: Sat Jul 04, 2009 5:48 pm    Post subject: Reply with quote

slovach wrote:
I'm pretty sure you can disable it if I remember right?

This is also why you have the other search functions in CE. Search unknown, search changed, etc, etc.


Anyway, it's probably just a simple disabled, enabled deal (0 and 1 respectively).
You can also restart the application and find it again.. Anyway, I was bored and got meself the address: 01024FF8
Back to top
View user's profile Send private message
manc
Grandmaster Cheater
Reputation: 1

Joined: 16 Jun 2006
Posts: 551

PostPosted: Sun Jul 05, 2009 4:02 pm    Post subject: Reply with quote

Thanks Holly, that's the right address.

New problem. I believe I have gotten correct privileges to write to pinball's memory but it doesn't seem to be working.

Code:
void __fastcall TForm1&#58;&#58;CheckBox2Click&#40;TObject *Sender&#41;
&#123;

         if&#40; SetDebugPrivileges&#40;&#41; != 0 &#41;
return;
    else &#123;



         HWND hWnd = FindWindow&#40;0, "3D Pinball for Windows - Space Cadet"&#41;;
         HANDLE hProcess = 0;
         DWORD PID = 0;
         GetWindowThreadProcessId&#40; hWnd, &PID &#41;;
         hProcess = OpenProcess&#40; PROCESS_ALL_ACCESS, false, PID &#41;;



VirtualProtectEx&#40; hProcess, &#40;LPVOID&#41;&#40;DWORD&#41;0x01000000, 0x5, PAGE_EXECUTE_READWRITE, NULL &#41;;
BYTE haxOn&#91;2&#93; = &#123; 0x01, 0x00 &#125;;

if&#40;CheckBox3->Checked == true&#41;
WriteProcessMemory&#40; hProcess, &#40;LPVOID&#41;&#40;DWORD&#41;0x01024FF8, &haxOn, 2, NULL &#41;;

&#125; //closes the else

&#125;  //closes the whole functon


Yes, this is Borland C++ Builder. I am starting to think the code is right but the code proprietary to Borland is wrong ( the CheckBox3->Checked == true; part). Can anyone confirm this?

Edit: Ok wtf is it just me or is this code full of random "&#125;"'s and stuff.

I dont know why I cant paste my code without it turning into symbols and stuff...so heres the code at pastebin if anyone has the time. http://pastebin.com/m2dcb416a

_________________
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Sun Jul 05, 2009 5:16 pm    Post subject: Reply with quote

1. Step through it in the debugger
2. Throw some GetLastError() after your calls.
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