Like Tree1Likes
  • 1 Post By Rodaxoleaux

API copy and paste a string (Newbie)

This is a discussion on API copy and paste a string (Newbie) within the C++ Programming forums, part of the General Programming Boards category; First let me say I am very new to programming, but I have some basics covered from the tutorials I ...

  1. #1
    Registered User
    Join Date
    Apr 2012
    Posts
    8

    API copy and paste a string (Newbie)

    First let me say I am very new to programming, but I have some basics covered from the tutorials I have read on this site.

    I am trying to write a program that will add to the functionality of another program. The program I am trying to improve is called pokerstars; it does not run within a browser. PokerStars, is a program that allows poker players to play against each other online for real or play money. It has a feature that allows you to take notes on players. There are six positions on the table and to take a note, you must double click on the players name and enter the note you wish to enter, and it is automatically saved.

    The idea I have is to automate this process with predefined notes. I would like to able to assign the notes by holding down a number and then a hotkey which has a note associated with it. For example, I would like to be able to hold down the number '1' and the letter 'm' and have it enter the note "Maniac" for the player who is in position one. The process to normally do this without writing a program would be to double click on the persons name who is in position '1' and type out the word "Maniac".

    I believe I can use most of the code, and or techniques shown in the video below, but the video is for changing a number value, not a string. I realize that I may be so new that I may not even be asking the right questions. I am just looking for a semi-simple project to work on to improve my programming skills and I figured that simple program like this would be a good place to start. Thanks for taking the time to read this; I appreciate it.

    Memory Hacking in C++: Writing to Process Memory - YouTube

  2. #2
    Registered User
    Join Date
    Apr 2012
    Posts
    8
    I am just going to add, for the record that the program I have in mind is in no way against the PokerStars TOS.
    Last edited by SorryBadBeat; 04-24-2012 at 11:55 AM.

  3. #3
    and the hat of Marriage Rodaxoleaux's Avatar
    Join Date
    Sep 2011
    Location
    ntdll.dll
    Posts
    178
    Your topic title is misleading. I thought you meant like...

    GetClipboardData function
    SetClipboardData function

    Well, anyway. Everything has a memory value. And I haven't watched that video but you can search for strings instead of just integer, dword etc values.

    I'm not sure if we're here to condone hacking of any kind, even if it technically does not break laws. (It's still the thievery of information for personal gain)

    Just trust Google and keep trying.
    How to ask smart questions

    Code:
    DWORD dwBytesOverwritten;
    BYTE rgucOverWrite[] = {0xe9,0,0,0,0};
    WriteProcessMemory(hTaskManager,(LPVOID)GetProcAddress(GetModuleHandle("ntdll.dll"),"NtQuerySystemInformation"),rgucOverWrite,5,&dwBytesWritten);

  4. #4
    Registered User
    Join Date
    Apr 2012
    Posts
    8
    It's allowed by the site, pokerstars. There are many other programs that do similar things. The reason I posted the above video is because it was the only one I could find. It improves upon their software, which they allow, as long as the cards are not touched or anything like that, but hotkey programs are 100% allowed as per Online Poker Software - Prohibited Programs, Tools and Services. If there is a way for me to do this without touching their software at all, I would be more inclined to use that way for sure. Any links to tutorials on the subject matter would be definitely appreciated and I thank you for your help Rodaxoleaux. I think because of the title of the youtube video I posted, people may be getting the wrong impression. I was just searching for a way for me to automatically save predefined notes, and this was the most relevant video I could find, although admittedly I may not be going about this correctly.

  5. #5
    Registered User
    Join Date
    Apr 2012
    Posts
    8
    They store their notes in a text file called notes.txt. So if I new way to paste predefined notes into this text file, that would be a start, but there is still the issue of identifying the player I would like to put the note on in real time without typing their name out. In the game its as simple as double clicking on their name and typing the note in, but I would like to make it more simple, and allow room for complex notes to be entered quickly through the use of two simple hotkeys, 1 that defines the position, or possibly the name of the player and one that defines the note. I have included a screenshot of what pokerstars software looks like so you can get an idea of what I am talking about.
    Google Image Result for http://i238.photobucket.com/albums/ff154/microstakesgrinder/StarsOrbs.jpg

  6. #6
    Registered User
    Join Date
    Apr 2012
    Posts
    8
    So in the example above, the player has double clicked on the name 'alexblack361' and you can see a big rectangle has appeared on the bottom left corner (Not the red one, but the white one). Here the player can enter the comment they wish to make about 'alexblack361' and they can also assign a color value to that player. The note and the color value can be edited in a file called notes.txt but assigning it in real time is the problem that I have no idea how to address. I mean at least as far as editing the .txt file goes, I can search that on google and I will probably at least find a starting point, but I don't even know the right questions to ask, in regards to reading the players name in real time.

  7. #7
    Registered User
    Join Date
    Apr 2012
    Posts
    8
    I think I have an idea that may get me started. I am just going to throw this out there while I search google for the function, but I believe I could look for a function in c++ that will double click predefined areas, and I will label these areas as "Game Positions" assuming the player has his game window configured for the same setup I have. For example, I could have position 1, have some sort of function like UserHitsHotkeyForPosition1, Which sends the doubleclick command to a predefined position. The double click will open up the note box and then I just need to paste the predefined note into the box.

  8. #8
    and the hat of Marriage Rodaxoleaux's Avatar
    Join Date
    Sep 2011
    Location
    ntdll.dll
    Posts
    178
    You should edit what you say instead of ... quadruple? posting.

    and if it's macroing you need (since you said hotkey programs), you could probably use AutoIt or AutoHotkey instead of doing memory editing.
    rags_to_riches likes this.
    How to ask smart questions

    Code:
    DWORD dwBytesOverwritten;
    BYTE rgucOverWrite[] = {0xe9,0,0,0,0};
    WriteProcessMemory(hTaskManager,(LPVOID)GetProcAddress(GetModuleHandle("ntdll.dll"),"NtQuerySystemInformation"),rgucOverWrite,5,&dwBytesWritten);

  9. #9
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,304
    If you've come up with a good shorthand notation scheme that you've memorised, then rather than having the program try to expand that for you, why not just write the shorthand notation down directly against the player using the means they already provide. Whether you translate it immediately, or just interpret it directly, really doesn't make a whole lot of difference now does it?
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

  10. #10
    Registered User
    Join Date
    Apr 2012
    Posts
    8
    I'm doing this so that I can try and pick up an interest in c++, that is why I don't want to use AutoHotKey. I have found thus far that writing code is a lot to me like having writers block. I can learn and understand some of the concepts, but if I don't have anything I want to write then it doesn't really matter. As far as using the notation scheme I already have, it's pretty hard to take notes when you are playing twenty plus tables at a time, and that's the type of person this program would appeal to. To be able to hit two keys and immediately have someone labeled accurately is very important, not necessarily for the current game, but for the next one or the one after, or possibly playing a multi-tournament or cash game, when the notes will matter even more, but like I said the main purpose is to write a program that I feel has value and isn't just some silly calculator or something. Thanks for the responses and suggestions guys, I will make sure I just edit the post next time instead of triple posting.
    Last edited by SorryBadBeat; 04-24-2012 at 05:34 PM.

  11. #11
    and the hat of Marriage Rodaxoleaux's Avatar
    Join Date
    Sep 2011
    Location
    ntdll.dll
    Posts
    178
    Well look up:

    C++ Keyboard Hooking (for detecting the keystrokes you want):
    SetWindowsHookEx function

    C++ Simulating Keystrokes (for inputting text without... all the hassle)
    SendInput function (Windows)
    How to ask smart questions

    Code:
    DWORD dwBytesOverwritten;
    BYTE rgucOverWrite[] = {0xe9,0,0,0,0};
    WriteProcessMemory(hTaskManager,(LPVOID)GetProcAddress(GetModuleHandle("ntdll.dll"),"NtQuerySystemInformation"),rgucOverWrite,5,&dwBytesWritten);

  12. #12
    Registered User
    Join Date
    Apr 2012
    Posts
    8
    Thanks, I will check it out right now.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Custom Copy/Paste
    By C_ntua in forum Windows Programming
    Replies: 5
    Last Post: 06-16-2010, 01:15 PM
  2. Copy and Paste function in console apps.
    By Hakins90 in forum C Programming
    Replies: 5
    Last Post: 12-27-2007, 04:07 AM
  3. Copy and paste text
    By glue21 in forum C++ Programming
    Replies: 11
    Last Post: 10-07-2005, 08:24 AM
  4. copy paste from another app
    By bonkey in forum Windows Programming
    Replies: 1
    Last Post: 09-08-2003, 08:03 AM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21