Results 1 to 12 of 12
  1. #1
    Kiruku's Avatar
    Join Date
    Feb 2009
    Gender
    male
    Location
    Aresden
    Posts
    80
    Reputation
    10
    Thanks
    203
    My Mood
    Relaxed

    Mouse events in C++

    Okay there, I've started on some try arounds in Crossfire with mouse events etc. (trying to code some kind of AFK bot), I've seen some AFK bots here working coded with visualbasic and requiring microsoft framework, and then they dont even work for me in XP 32bit.

    Whats working:
    SetCursorPos -> in any menu
    GetCursorPos -> in any menu and ingame (centered because cf centers normal mouse pointer)


    HWND hWnd= GetForegroundWindow ( );
    GetClientRect ( hWnd, &arect );
    GetCursorPos ( &point );
    PostMessage ( hWnd, WM_LBUTTONDOWN, 0, ( point.x - arect.left ) & ( ( point.y - arect.top ) << 16 ) );
    PostMessage ( hWnd, WM_LBUTTONUP, 0, ( point.x - arect.left ) & ( ( point.y - arect.top ) << 16 ) );
    for clicking in any menu (not ingame)


    what has absolutely no effect in CF but in any other program:
    SendInput
    keybd_event
    mouse_event
    SetKeyboardState(not sure if I did it correctly with that one, but from what I've read im kinda sure this doesnt work also)



    Does any1 have an idea how I can get ingame clicks to work so my character starts shooting or just already a mouse move would rock... I take anything xD (even just small ideas) (well only thing is it should be C++ or ASM xD)
    Well im pretty sure i did wrong because WinAPI surely isnt the right thing for cf since its 3d... maybe i need d3d programming or smth? i am not very informed, but I would start to inform myself if I knew what I need to inform about xD(or prolly some1 helps me but i dont guess that, since we all are human, and humans are lazy xD)

    Im also happy for C++ solutions on 64 bit or win7 64 bit w/e because I buy a new PC very soon.
    I would be very thankful for help I get here.



    Greets Kiruku

  2. #2
    Takari's Avatar
    Join Date
    Feb 2010
    Gender
    male
    Location
    Cross Fire Section
    Posts
    11,889
    Reputation
    574
    Thanks
    1,966
    My Mood
    Cool
    Post this in these sections next time,since we don't know good coding here:
    CrossFire Hack Source Code - MPGH - MultiPlayer Game Hacking
    C++/C Programming - MPGH - MultiPlayer Game Hacking

  3. The Following User Says Thank You to Takari For This Useful Post:

    Kiruku (04-01-2011)

  4. #3
    Kiruku's Avatar
    Join Date
    Feb 2009
    Gender
    male
    Location
    Aresden
    Posts
    80
    Reputation
    10
    Thanks
    203
    My Mood
    Relaxed
    Quote Originally Posted by Takari View Post
    Post this in these sections next time,since we don't know good coding here:
    CrossFire Hack Source Code - MPGH - MultiPlayer Game Hacking
    C++/C Programming - MPGH - MultiPlayer Game Hacking
    Thanks, but rules on Source for crossfire hacks looks like no help requests allowed there so i guessed since its for CF to post here....

  5. #4
    Takari's Avatar
    Join Date
    Feb 2010
    Gender
    male
    Location
    Cross Fire Section
    Posts
    11,889
    Reputation
    574
    Thanks
    1,966
    My Mood
    Cool
    Quote Originally Posted by Kiruku View Post
    Thanks, but rules on Source for crossfire hacks looks like no help requests allowed there so i guessed since its for CF to post here....
    Yep,but not many people that can code are here in the help section.Try posting in the second link I told you.

  6. #5
    Gab's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Posts
    6,716
    Reputation
    1755
    Thanks
    1,543
    Moved in the C++ programmin section

  7. The Following User Says Thank You to Gab For This Useful Post:

    Kiruku (04-01-2011)

  8. #6
    whit's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Posts
    7,159
    Reputation
    490
    Thanks
    2,253
    Quote Originally Posted by Kiruku View Post
    I've seen some AFK bots here working coded with visualbasic and requiring microsoft framework, and then they dont even work for me in XP 32bit.


    what has absolutely no effect in CF but in any other program:
    SendInput
    keybd_event
    mouse_event
    SetKeyboardState(not sure if I did it correctly with that one, but from what I've read im kinda sure this doesnt work also)
    What you think Visual C++ Requires

    And may we see the your Code?

  9. #7
    Kiruku's Avatar
    Join Date
    Feb 2009
    Gender
    male
    Location
    Aresden
    Posts
    80
    Reputation
    10
    Thanks
    203
    My Mood
    Relaxed
    Quote Originally Posted by whit View Post
    What you think Visual C++ Requires

    And may we see the your Code?
    ofc it requires it... whatever i just hate VB (no fun to code)(btw. ive been coding with Vim and MinGW for a while, i guess i didnt need back then? Console ftw)

    my code, looks fcking messy since ive tried so much around with it, most infos i basically posted, its just a thread with
    while(1){
    if(GetAsyncKeyState(VK_F2)&1) {

    for(i=0;i<DEF_MAXCOORDS-1;i++){
    if (x[i] == 0) break;
    SetCursorPos(x[i],y[i]);
    keybd_event(0x41, 0, 0, 0);
    keybd_event(0x41, 0, KEYEVENTF_KEYUP, 0);
    mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
    mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
    Sleep(time);
    }

    }
    }
    all the functions i tested worked everywhere but in CF...

    edit: abt the framework thing, i never got error on C++ written progs yet that i have to download newer framework nor gotten that annoying framework error blbalba lets not loose the discussion into framework or not, i may be dumb on that region but i dont even want to know atm.
    Last edited by Kiruku; 04-01-2011 at 04:06 PM.

  10. #8
    why06's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    IBM
    Posts
    4,304
    Reputation
    170
    Thanks
    2,203
    My Mood
    Flirty
    I haven't been able to download CF without my computer crashing for some reason, but it could be that CF ignores all external inputs and only accepts inputs, from within its window, or process. Idk, but I would try injecting a DLL and trying the same thing.

    Oh and CF could also, and most likely be doing a global hook, on GASKS(), so the button press never reaches your program, but again idk, you'll have to test all these options. you can start with testing if the code is executed when F2 is pressed inside the game, and injecting a DLL.

    "Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."
    - Dwight D. Eisenhower

  11. #9
    whit's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Posts
    7,159
    Reputation
    490
    Thanks
    2,253
    Quote Originally Posted by why06 View Post
    I haven't been able to download CF without my computer crashing for some reason
    CF dont work on xp

  12. #10
    Kiruku's Avatar
    Join Date
    Feb 2009
    Gender
    male
    Location
    Aresden
    Posts
    80
    Reputation
    10
    Thanks
    203
    My Mood
    Relaxed
    it does work on XP SP3 32bit...

    i also tried injecting the DLL and tried the same... same result

    if i press F2 ingame, it doesnt click or do anything but hwen i press ESC for the menu afterwards (i looped it so it will repeat always) in Menu it worked...

    means: it gets asynckeystate but the game doesnt accept click in the 3d Engine, in the menu it accepts... (but only the functions i wrote there)
    Last edited by Kiruku; 04-02-2011 at 08:50 AM.

  13. #11
    SoWhat's Avatar
    Join Date
    Mar 2011
    Gender
    male
    Posts
    1,268
    Reputation
    15
    Thanks
    59
    My Mood
    In Love
    Xp is bad to play game !! win7

  14. #12
    Kiruku's Avatar
    Join Date
    Feb 2009
    Gender
    male
    Location
    Aresden
    Posts
    80
    Reputation
    10
    Thanks
    203
    My Mood
    Relaxed
    we can stop disussing this offtopic please? i get new comp in 3 days with win7, but there will be the same i guess, and if not, i want to know why xD. btw. if u try loading win7 on this computer i guess u will have trouble even pressing power on button so dont try to tell me get win7 for those days.