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++ somehow help :S

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

Joined: 30 Oct 2006
Posts: 1597

PostPosted: Thu Apr 17, 2008 3:50 pm    Post subject: C++ somehow help :S Reply with quote

Hi there..

I was just making a code at C++ to try to help my friend with his MS Server, so w.e time the server crash, it will auto-run. But since his crash is by errors on buff overflow as spected, so the .exe of the server cannot be run, so it must be run by the compiler. So here is my code so far.

Code:
#include <iostream>
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include "stdafx.h"
using namespace std;

HANDLE hConsole;
HWND FindMapleWindow;
HWND FindMapleWindow2;
HWND FindMapleWindow3;
HWND FindMapleWindow4;
HWND FindMapleWindow5;
DWORD gamePid;   
HANDLE hGame;

void main () {

for (;;){

   if (FindMapleWindow = FindWindow( NULL , "Microsoft Visual C++ Debug Library")){
      while(FindMapleWindow==GetForegroundWindow()) {
      ShowWindow(FindMapleWindow,SW_SHOWMAXIMIZED);
      SetForegroundWindow(FindMapleWindow);
        keybd_event(VK_RETURN,0,0,0);
      Sleep(500);
      }
      if(FindMapleWindow4 = FindWindow( NULL , "MapleStoryServer (Debugging) - Visual C++ 2008 Express Edition (Administrator)")){
      FindMapleWindow4=GetForegroundWindow();
      SetForegroundWindow(FindMapleWindow4);
      keybd_event(VK_LSHIFT,0xaa,0,0);   
        keybd_event(VK_F5,0xbf,0,0);
      keybd_event(VK_LSHIFT,0xaa,KEYEVENTF_KEYUP,0);   
        keybd_event(VK_F5,0xbf,KEYEVENTF_KEYUP,0);
      Sleep(500);
      keybd_event(VK_F5,0,0,0);
      }
      else if(FindMapleWindow3 = FindWindow( NULL , "MapleStoryServer - Visual C++ 2008 Express Edition (Administrator)")){
      FindMapleWindow3=GetForegroundWindow();
      SetForegroundWindow(FindMapleWindow3);
      keybd_event(VK_LSHIFT,0xaa,0,0);   
        keybd_event(VK_F5,0xbf,0,0);
      keybd_event(VK_LSHIFT,0xaa,KEYEVENTF_KEYUP,0);   
        keybd_event(VK_F5,0xbf,KEYEVENTF_KEYUP,0);
      Sleep(500);
      keybd_event(VK_F5,0,0,0);
      }
   }

   else if(FindMapleWindow2 = FindWindow( NULL , "Visual C++ 2008 Express Edition")){
      Sleep(200);
        while(FindMapleWindow2==GetForegroundWindow()) {
      SetForegroundWindow(FindMapleWindow2);
        keybd_event(VK_RETURN,0,0,0);
      Sleep(500);
      }
    if(FindMapleWindow3 = FindWindow( NULL , "MapleStoryServer (Debugging) - Visual C++ 2008 Express Edition (Administrator)")){
      FindMapleWindow3=GetForegroundWindow();
      SetForegroundWindow(FindMapleWindow3);
      keybd_event(VK_LSHIFT,0xaa,0,0);   
        keybd_event(VK_F5,0xbf,0,0);
      keybd_event(VK_LSHIFT,0xaa,KEYEVENTF_KEYUP,0);   
        keybd_event(VK_F5,0xbf,KEYEVENTF_KEYUP,0);
      Sleep(500);
      keybd_event(VK_F5,0,0,0);
      }
   }
}
}


So the program works. But when the "Debug Library" error pop-ups, it dose'nt, but when the anotther error comes, it does. So, this happends because Debug Library error is not "focused" when pop-ups, so, i tried to Maximixed, which im not sure if that does works, since im not tht good with that part. Anyhow, could someone explain where im failing in this?

Thanks ^^

_________________

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

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

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

Wow wtf! Why don't you just do it once and use the Window Class instead of the name..
Back to top
View user's profile Send private message MSN Messenger
DeletedUser14087
I post too much
Reputation: 2

Joined: 21 Jun 2006
Posts: 3069

PostPosted: Fri Apr 18, 2008 2:35 am    Post subject: Reply with quote

dude, so freaking messy
Back to top
View user's profile Send private message
Snootae
Grandmaster Cheater
Reputation: 0

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

PostPosted: Fri Apr 18, 2008 4:21 am    Post subject: Reply with quote

Quote:
because Debug Library error is not "focused"


use setactivewindow:

Code:
http://msdn2.microsoft.com/en-us/library/ms646311(VS.85).aspx

_________________
Back to top
View user's profile Send private message
XxOsirisxX
Grandmaster Cheater Supreme
Reputation: 0

Joined: 30 Oct 2006
Posts: 1597

PostPosted: Sat Apr 19, 2008 6:00 pm    Post subject: Reply with quote

ty for the replies ^^

Quote:
Wow wtf! Why don't you just do it once and use the Window Class instead of the name..


Because the class name, at least of 1 error that my friend send me the class, is a #number, so i will end up with the same thing, and also, it will be even bigger, since there may be others errors, but with the same Window text.

Quote:
Snootaeuse setactivewindow:


Thanks you ^^ even trough apparetnyl that dose'nt works, since my friend says it still dose'nt close it :s.

Anyhow, he means to leave it like it's atm even it dose'nt close that error pop-ups, thanks you so much ^^

_________________

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

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Sat Apr 19, 2008 6:06 pm    Post subject: Reply with quote

x0r wrote:
noz3001 wrote:
Wow wtf! Why don't you just do it once and use the Window Class instead of the name..

It's a generic console window.


No it isn't.



noitisnt.JPG
 Description:
 Filesize:  14.39 KB
 Viewed:  5388 Time(s)

noitisnt.JPG


Back to top
View user's profile Send private message MSN Messenger
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Sat Apr 19, 2008 6:41 pm    Post subject: Reply with quote

Irwin is correct. I spied on the window and it's the generic console class. So if his app isn't win32 and a seperate class, just that being open and the server not being open would register as the server being open.
_________________
Back to top
View user's profile Send private message
Noz3001
I'm a spammer
Reputation: 26

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Sun Apr 20, 2008 3:23 am    Post subject: Reply with quote

Sorry, I don't have a clue about what you are trying to do then.
Back to top
View user's profile Send private message MSN Messenger
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