Results 1 to 6 of 6
  1. #1
    programme-zero's Avatar
    Join Date
    Apr 2013
    Gender
    male
    Posts
    36
    Reputation
    10
    Thanks
    15
    My Mood
    Angelic

    [C++]HWND hWnd = FindWindow don't find the window

    #include <windows.h>
    #include <iostream>

    int main()
    {
    using namespace std;

    int compteur_un = 0;
    int compteur_deux = 0;
    bool boucle = true;
    system("title Black Ops 2 Trainer");
    cout << "Trainer Black Ops 2 Zombie" << endl;
    HWND hWnd = FindWindow(0, "Call of Duty(R): Black Ops II - Zombies"); //Don't find the window
    if(hWnd == 0)
    {

    MessageBox(0, "Can't find window.", "Erreur", MB_OK|MB_ICONERROR);
    }
    else
    {
    DWORD proccess_ID;
    GetWindowThreadProcessId(hWnd, &proccess_ID);
    HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, proccess_ID);
    if(!hProcess)
    {
    MessageBox(0, "Can't open the process", "Erreur!", MB_OK|MB_ICONERROR);
    }
    return 0;
    }

    Help me please.

  2. #2
    xVIRUZx's Avatar
    Join Date
    Feb 2013
    Gender
    male
    Posts
    248
    Reputation
    10
    Thanks
    52
    My Mood
    Drunk
    It is not "Call of Duty(R): Black Ops II - Zombies", but "Call of Duty®: Black Ops II - Zombies".

  3. #3
    Horror's Avatar
    Join Date
    Oct 2010
    Gender
    male
    Location
    51,4.
    Posts
    6,920
    Reputation
    574
    Thanks
    5,050
    My Mood
    Twisted
    Quote Originally Posted by programme-zero View Post
    FindWindow(0,
    Don't see how that 0's necesairy.
     

    Minion+ : February 2014 - January 2015
    Counter Strike: Global Offensive Minion : November 2014 - January 2015
    Alliance of Valiant Arms Minion : August 2014 - January 2015
    Need For Speed World Minion : January 2014 - January 2015
    Rust Minion : January 2014 - January 2015
    Call of Duty Minion : January 2013 - January 2015
    Editor : December 2012 - April 2013
    Donator : March 2014 - Current
    Member : October 2010 - Current

    Previously known as "Isaakske".

  4. #4
    programme-zero's Avatar
    Join Date
    Apr 2013
    Gender
    male
    Posts
    36
    Reputation
    10
    Thanks
    15
    My Mood
    Angelic
    Quote Originally Posted by xVIRUZx View Post
    It is not "Call of Duty(R): Black Ops II - Zombies", but "Call of Duty®: Black Ops II - Zombies".
    That work love you man.

  5. #5
    xVIRUZx's Avatar
    Join Date
    Feb 2013
    Gender
    male
    Posts
    248
    Reputation
    10
    Thanks
    52
    My Mood
    Drunk
    Quote Originally Posted by programme-zero View Post
    That work love you man.
    No problem, but I really thought it would not detect the window because of the ® symbol. If you have any problem with it, you can use this instead:

    Code:
    HWND hWnd = FindWindow("CoDBlackOps", 0);
    So with this you would detect the class name of the window instead of the window title, and it would also work for Singleplayer + Multiplayer without any problem.

    Quote Originally Posted by Horror View Post

    Don't see how that 0's necesairy.
    Take a look at this:

    Code:
    HWND WINAPI FindWindow(
      _In_opt_  LPCTSTR lpClassName,
      _In_opt_  LPCTSTR lpWindowName
    );
    We wanted to find the window name, not the class name, that's why we put 0.

    /requestlock
    Last edited by xVIRUZx; 08-30-2013 at 01:43 PM.

  6. #6
    Kenshin13's Avatar
    Join Date
    May 2011
    Gender
    male
    Location
    Cloud 9
    Posts
    3,470
    Reputation
    564
    Thanks
    6,168
    My Mood
    Psychedelic
    Quote Originally Posted by Horror View Post
    Don't see how that 0's necesairy.
    Just for the future reference,
    Code:
    HWND WINAPI FindWindow(
      _In_opt_  LPCTSTR lpClassName,
      _In_opt_  LPCTSTR lpWindowName
    );
    Since we usually leave the class name empty (In most cases), we use 0 as a placeholder.


    Crap. Just read the above message..

Similar Threads

  1. Help: Stick window to another window
    By winberg in forum C++/C Programming
    Replies: 4
    Last Post: 04-19-2011, 01:31 AM
  2. window above games window
    By KuChI-PoChI in forum Visual Basic Programming
    Replies: 12
    Last Post: 08-07-2010, 07:37 AM
  3. CLR C++ FindWindow help[SOLVED]
    By spwn in forum C++/C Programming
    Replies: 37
    Last Post: 06-15-2010, 05:38 PM
  4. How do i know if a hack work/will work on window Vista or window 7?
    By lockster in forum CrossFire Hacks & Cheats
    Replies: 9
    Last Post: 12-03-2009, 04:10 AM
  5. [Help] i really cant find the link of SuddenAttackSEA hack for window xp ..
    By Darren95 in forum Sudden Attack General
    Replies: 7
    Last Post: 11-10-2009, 05:10 PM