Sending text programmatically to Pokerstars table

this took me awhile to figure out and I’ve had to change it on occasion after some pokerstars updates, besides the PS updates, it’s never failed.

I included the GetText declarations because It’s simple to first grab any text you may be typing in the pokerstars chat enter area at the moment the sub fires, save it as a string somewhere, and then replace it after the sub has sent the programmed chat. This will keep any text you’re typing to the table from being wiped out by the Sub.

use the sub like this:  SendChatToPokerstarsTable(“nice hand”)

Martin Carter –
PrivateConst WM_SETTEXT = &HC 
PrivateConst WM_GETTEXT = &HD 
PublicConst WM_CHAR = &H102

PublicDeclareFunction GetWindowTextLength Lib“user32.dll”Alias“GetWindowTextLengthA” (ByVal hWnd AsLong) AsLong

PublicDeclareFunction GetWindowText Lib“user32.dll”Alias“GetWindowTextA” (ByVal hWnd AsLong, ByVal prmstrString AsString, ByVal nMaxCount AsLong) AsLong

PublicDeclareFunction FindWindow Lib“user32”Alias“FindWindowA” (ByVal lpClassName AsString, ByVal lpWindowName AsString) AsInteger

PublicDeclareFunction FindWindowEx Lib“user32”Alias“FindWindowExA” (ByVal hWnd1 AsInteger, ByVal hWnd2 AsInteger, ByVal lpsz1 AsString, ByVal lpsz2 AsString) AsInteger

PublicDeclareFunction SendMessageSTRING Lib“user32”Alias“SendMessageA” (ByVal hwnd AsInteger, ByVal wMsg AsInteger, ByVal wParam AsInteger, ByVal lParam AsString) AsInteger

DeclareFunction sendmessagebynum& Lib“user32”Alias“SendMessageA” (ByVal hWnd AsInteger, ByVal wMsg AsInteger, ByVal wParam AsInteger, ByVal lParam AsInteger)

PublicSub SendChatToPokerstarsTable(ByVal Chat)

Dim pokerstarstableframeclass AsLong = FindWindow(“pokerstarstableframeclass”, vbNullString)

Dim pokerstarschateditorclass AsLong = FindWindowEx(pokerstarstableframeclass, 0&, “pokerstarschateditorclass”, vbNullString)

If pokerstarschateditorclass = 0 Then

Exit Sub


Call SendMessageSTRING(pokerstarschateditorclass, WM_SETTEXT, 0&, Chat)

Call sendmessagebynum(pokerstarschateditorclass, WM_CHAR, 13, 0)




You can also loop thru a textbox and instantly send multilines of text to the table.

Dim ChatLines() AsString = Split(TextBox1.Text, vbNewLine)

ForEach line In ChatLines

If line = “” Then line = “.”





  1. Comment by ian:

    Thanks, That works great. How can I make it say something automatically after every hand? And how can I use this at other sites?

    • Comment by martin:

      ok I wrote a post to trigger the hand completion. I wrote it in a blank form and haven’t tested it but its the same as I use. if I skipped something just let me know and if you find and fix anything please repost the fixed code in a reply and i’ll repair the post

    • Comment by martin:

      to send text to another “client” (its not a website, pokerstars is an .exe that you run on your comp) you need to return the window handles of the textbox that you type the chat into in THAT program. you can use any apispy to find the handles or even write a spy yourself. I have an old one from my vb6 days, lemme upload it real quick.

      APISPY to find window handles

      • Comment by jeromy d:

        I got APISPY from that link, how do I get the windows?

      • Comment by martin:

        open it, select “just find the window”, drag the circle to the object you want to return. it will show you the tree in code from parent to child to object or whatever.

        the prt you write in notepad will return…

        Dim notepad As Long, editx As Long
        notepad = FindWindow(“notepad”, vbNullString)
        editx = FindWindowEx(notepad, 0&, “edit”, vbNullString)

  2. Comment by jeromy d:

    HEY this worked great! this is fast too thanks who posted these. keep them coming because I might try to make a stats thing also

Leave a Reply to ian Cancel reply

Hit Counter provided by shuttle service from lax