Results 1 to 7 of 7
  1. #1
    HOOSIER's Avatar
    Join Date
    Aug 2012
    Gender
    male
    Location
    CyberSpace
    Posts
    962
    Reputation
    33
    Thanks
    2,352
    My Mood
    Cheerful

    C++ console question

    Sorry but I am new to C++ and work mainly in VB.net
    How can I Code my Console app to wait for my games process to be opened ?
    I have tried some do whiles but they failed .
    And I have looked for an example but have not found one that is right .
    Everything else is working correctly I just can not seem to get that part correct .
    Please remember I am very very new to the c language .
    And i never really tried to code any project to wait for an .exe i would just have it throw an error message .
    Any decent example would be great thank's .
    Last edited by HOOSIER; 10-18-2015 at 11:07 AM.

  2. #2
    ~BlackMaster~'s Avatar
    Join Date
    May 2014
    Gender
    male
    Location
    ummm... :B
    Posts
    48
    Reputation
    10
    Thanks
    4
    My Mood
    Amused
    convert this logic into C++:

    while the handle is invalid keep looping and call the openhandle function.

  3. #3
    SpyLegion's Avatar
    Join Date
    Dec 2014
    Gender
    male
    Location
    127.0.0.1
    Posts
    171
    Reputation
    10
    Thanks
    999
    My Mood
    Twisted
    That's not the right answer tbh but ok !

  4. #4
    ~BlackMaster~'s Avatar
    Join Date
    May 2014
    Gender
    male
    Location
    ummm... :B
    Posts
    48
    Reputation
    10
    Thanks
    4
    My Mood
    Amused
    Quote Originally Posted by SpyLegion View Post
    That's not the right answer tbh but ok !
    If you know the id it will work. Else you can create a snapshot of the processes, enumerate 'em all comparing szExeName or w/e the member's name was.

    Care to explain why the logic is wrong?

  5. #5
    HOOSIER's Avatar
    Join Date
    Aug 2012
    Gender
    male
    Location
    CyberSpace
    Posts
    962
    Reputation
    33
    Thanks
    2,352
    My Mood
    Cheerful
    Quote Originally Posted by ~BlackMaster~ View Post
    convert this logic into C++:

    while the handle is invalid keep looping and call the openhandle function.
    I do better with a visual example I would think a do while would work but i have not had any luck . So I searched for some examples to which I could not find any so i turned to this post . And in my opinion a tutorial on just suck a thing should be on here really .

  6. #6
    Septus10's Avatar
    Join Date
    Mar 2010
    Gender
    male
    Location
    Under your bed
    Posts
    32
    Reputation
    10
    Thanks
    8
    My Mood
    Doh
    Quote Originally Posted by HOOSIER View Post
    I do better with a visual example I would think a do while would work but i have not had any luck . So I searched for some examples to which I could not find any so i turned to this post . And in my opinion a tutorial on just suck a thing should be on here really .
    Code:
    //inside your main function
    HWND tarWnd = NULL;
    
    std::cout << "Searching for window: Example name\n";
    
    while(tarWnd == NULL)
    {
        tarWnd = FindWindow(NULL, "Example name");
    }
    
    std::cout << "Window: "Example name"  found! Executing program.\n";
    Something like this? (This will look for the window, but looking for the actual process will be pretty much the same)
    Last edited by Septus10; 10-20-2015 at 03:15 PM.

  7. #7
    HOOSIER's Avatar
    Join Date
    Aug 2012
    Gender
    male
    Location
    CyberSpace
    Posts
    962
    Reputation
    33
    Thanks
    2,352
    My Mood
    Cheerful
    Quote Originally Posted by Septus10 View Post
    Code:
    //inside your main function
    HWND tarWnd = NULL;
    
    std::cout << "Searching for window: Example name\n";
    
    while(tarWnd == NULL)
    {
        tarWnd = FindWindow(NULL, "Example name");
    }
    
    std::cout << "Window: "Example name"  found! Executing program.\n";
    Something like this? (This will look for the window, but looking for the actual process will be pretty much the same)
    Thank's you

Similar Threads

  1. Ghosts Console question
    By BigScotiaBhoy in forum General
    Replies: 7
    Last Post: 01-18-2014, 02:38 PM
  2. Console question
    By kibana in forum Vindictus Help
    Replies: 4
    Last Post: 11-18-2011, 01:51 AM
  3. [Solved] console question
    By ultimakills in forum Call of Duty Black Ops Help
    Replies: 5
    Last Post: 07-14-2011, 03:51 PM
  4. console question
    By Etherealblood in forum Vindictus Help
    Replies: 7
    Last Post: 05-12-2011, 01:24 PM
  5. Console question
    By Alex427 in forum Call of Duty Modern Warfare 2 Help
    Replies: 0
    Last Post: 03-25-2010, 01:21 PM