I need low level access in another programming language

Ask gaming related questions (AHK v1.1 and older)
Bugattikid2012
Posts: 11
Joined: 20 Oct 2014, 20:27

I need low level access in another programming language

08 Apr 2015, 16:36

Long story short, I made a AHK script a while back that worked just fine. It allows me to play BF4 and send quick messages by pressing a hotkey such as "We're losing Alpha!" It allows me to communicate with my team easily, and can really help out. The problem? AHK is banned by punkbuster, due to it being used by no-recoil tricks. I do not intend to cheat in this way, I just want to be able to send messages.

I know there's no easy way to get AHK to work, so I made a program in the programming language of D to send these messages. It works fine in notepad, but when I put it in game, the chat key isn't detected as being pressed. This is an issue I had in AHK as well, SendInput wouldn't work. The only command that would work in AHK for the chat key was standard Send. I need to know how Send functions, and I need to know how I can import that into my new program, or a workaround to fixing it in my new program. I'm pretty sure it'll involve the Winderp$ API, but I can't find a suitable method.

It seems the most logical step for me would be to figure out how Send works, so that I can mimic it. I will most likely need a developer to answer this question, as I assume they are the only ones who know how they set it up.

Any and all help is greatly appreciated, thank you in advance.
User avatar
Nextron
Posts: 1391
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win10 AHK: Unicode x32

Re: I need low level access in another programming language

08 Apr 2015, 16:57

Look into the keybd_event function at MSDN and use that with AHK's DllCall. You'll end up with something like DllCall("keybd_event", "UChar", GetKeyVK("NumPadSub"), "UChar", GetKeySC("NumPadSub"), "UInt", KeyEvent, "UInt", 0) ;KeyEvent: 0=down, 2=up
Bugattikid2012
Posts: 11
Joined: 20 Oct 2014, 20:27

Re: I need low level access in another programming language

08 Apr 2015, 17:21

I'm a bit confused here. I'm not trying to use AHK for this, but I need to figure out what AHK is doing for using the "Send" command, as it works fine.

I would use AHK, but my games have banned it due to no-recoil macros being made. I'm trying to figure out what Winderp$ API the "Send" key uses. Is it the keybd_event function that you listed?
User avatar
Nextron
Posts: 1391
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win10 AHK: Unicode x32

Re: I need low level access in another programming language

08 Apr 2015, 17:34

Doh.. Yeah, I understood the question, then instinct kicked in to add an AHK example :eh:.

Regardless, you'll probably want to use keybd_event.
Bugattikid2012
Posts: 11
Joined: 20 Oct 2014, 20:27

Re: I need low level access in another programming language

08 Apr 2015, 17:39

Alright, I'll see if I can figure out how to use it. Whatever it is that the "Send" command from AHK is using is what I need, nothing else seemed to work so that the game would detect the chat key press. I'm still a noob when it comes to programming, and Winderp$ API is apparently harder than most things to learn. Hopefully I can get it working... I'll post back if I hit any issues I can't figure out, but I'll try my best before doing so. Thanks!
Bugattikid2012
Posts: 11
Joined: 20 Oct 2014, 20:27

Re: I need low level access in another programming language

09 Apr 2015, 22:24

I apologize for asking you for help outside of a directly AHK related issue, but I'm staring to run out of places to look for help. I am a noob when it comes to programming. I understand the concept of how to do it, but I am NOT in the slightest familiar with any language or syntax format. Because of this, I have no clue as to what I need to do. I've asked around, but few people want to help me because I don't know what I'm doing basically, despite the IRC channels/subreddits being dedicated to helping noobs. Anyways...

Here is my latest version of the program I helped write. It works fine (before I made a few modifications) in a notepad, but when I bring it in game, the chat key is still not detected. I recently tried changing the wchars into scan codes in hopes that it would work. Sadly, it didn't. So I have reverted it back to wchars, but I have saved a version of both in case I need to quickly change or something.

I have tried to change anything referring to SendInput to keybd_event. There are only three occurrences of this, on lines 24,29, and 90. I'm sure I don't have the syntax right with any of them, and I'm not sure how to change it. I have a few ideas, but I couldn't get any of them to work on my own, and the one person who was helping me went AFK.

The MSDN for this new function is here. I'm a bit confused as to whether this program will input the text on its own, and would replace "sendSyntheticInput" alltogether, or if it would only replace the SendInput argument that was previously found on lines 24, 29, and 90 (note: The only thing I changed from the SendInput version was changing SendInput to keybd_event).

I've tried messing with it, but I can't get anything to work without spewing errors or simply not working. It's obviously user error on my part, but I just don't know how to fix it and I am hoping to learn how to fix it, and what I can do in the future to figure it out on my own. I want to /learn/ how to do this, but I don't want to spend a whole lot of time doing this for such a simple project. I'm a computer guy, been using Linux for years, and I've done a lot with computers, but never programming. Computers will be my job (still not sure specifically what, but I know it'll be in the computing field), and I'm interested in programming, I just don't want to invest a ridiculous amount of time for something that should be so darn simple.

Thank you very much for your quick reply, I hope I am not asking for too much. I just simply want to get this working, and learn something at the same time.

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 49 guests