Reading Last Line – ChatRoomClass to ListBox Problems

[youtube]UzHI40ELVcY[/youtube]

OK, So I am trying to add the Idea bro Departure came with, to add an option in our Auto-Reply Program for Paltalk, so it can save the incoming Text. I have so far completed to get the username + text from the PM the same way Locohacker have done in his Paltalk Bot Source, but he is using the RoomSelector and this problem is not accuring if I use the roomselector too, but I am not using the RoomSelector and this is why I get this problem with the program…. Please watch the Video for 41. seconds, I have created for the problem!

The product should grab the incoming or typed text in the Pm WINDOW. But when I cover the “Text Area” in RichEdit20W window with another Program or another Window, then the text added in the LISTBOX until I uncover the text area again, Plus It adds an EXTRA LINE for each time I remove the cover..

These are the Codes that are accuring this type of a problem (If can be called problem)

Private Function SendTxtHnd() As IntPtr
' Get connected chat room handle
Dim hWndMain As IntPtr = FindWindow(ChatRoomClass, vbNullString)
' Get Control handle
Return ControlSearchBottomUp(hWndMain, SendTextClass, SendTextIndex, SendTextSearchQuadrant)
End Function

Private Function ReadTxtHnd() As IntPtr
' Get connected chat room handle
Dim hWndMain As IntPtr = FindWindow(ChatRoomClass, vbNullString)
' Get Control handle
Return ControlSearchBottomUp(hWndMain, ReadTextClass, ReadTextIndex, ReadTextSearchQuadrant)
End Function

 

I was wondering if there is another way to add the ChatRoomClass code in the ReadTxtHnd and SendTxtHnd Code functions…? Thanks a lot in advance

Ps, I am already using a code for Duplicated words and text for the Listbox, plus that its also adding an EMPTY line, but I managed to cover the EMPTY lines too. The code with Duplicate Word is working OK, but in this case its not helping me… I think its creating a complete new session for each time I remove the cover of the Text-Area…..

5 thoughts on “Reading Last Line – ChatRoomClass to ListBox Problems

  1. If ControlSearchBottomUp is what I think it is, it is getting the control from screen position. The control must be the top level (not minimized and no other windows covering it) to get the control from screen. A big reason this method did not gain wide use.

    my guess is that when you cover the control with another window, the returned text is nothing. then when you uncover it, the resulting text is the last line again. this change triggering the recording of a new line.

    not sure how you are getting the new line and processing them, but you may want to get the incoming text, check if it is not nothing, and if no nothing then check if it is different from the previously last retrieved line of text.

  2. doesn’t the pm window have a different class name? or what is your reason for using the screen position function “ControlSearchBottomUp”.

    First start from scratch and find out what is different about a pm window than a room window…
    Hint: Maybe the room window has a child control that a the pm window does not have? A simple search through the controls could indicate if its a pm window or room window, then once you have worked that part out grab the text and close the pm window ready for next one to popup

  3. @autopilot wrote:

    If ControlSearchBottomUp is what I think it is, it is getting the control from screen position.

    @Auto-Pilot, You are right AutoPilot about that Its getting the controls from screen position! As I will explain below to bro Dep…I will def try to see if I can use your method by checking the retrieving messages for each time its recieved and the (Nothing) Part….

    And bro @Departure, about:

    A simple search through the controls could indicate if its a pm window or room window,

    The code I am using has a function called “Get Pm Window”! Something String came up with and Chike helped me to add the function correctly and ofcourse to check if a PM Contains Text or Not. The Function that is called “Get Pm Window” bassicly checks for DlgGroupChat Window Class“, and then for Window Titles that ends with the word “Room. So yes it does work and grabs the Chat-Room titles too if the Chat Room was open, and I can also send and grab text from the Chatroom too. But in this case do you think that the Public Chat-Room or grabbing Titles way would do any difference ?

    Thanks for the fast response bro Auto-Pilot and Dep…

  4. Sit back for a few minutes and really think how you want your auto reply program to work. Here are some ideas for you to think about.

    – The user has option to define his own custom message and using tags like $nick and $time in the formatted reply to be replaced with the nickname of the person sending the message, and of cause $time to use in the custom message, All messages should be logged.

    – When someone in the Public rooms say your name it should auto reply in the room with just an away message defined by the user, this of cause also gets logged.

    – A timer option to inform the rooms your in, that you are away, sending a user define message to selected rooms in a given interval.

    They are just a couple of ideas, Once you have decided what you want to include then its time to really think hard about you are going to implement these ideas on the logic’s on coding it. Personally I wouldn’t use other peoples pre-made function, Instead roll your own and it will be more suited to what you want the program to do without limitations, The added bonus is you might actually get to learn something while your coding this project.

    Good luck, and I agree with Autopilot about not using the screen position method, in fact If I remember correctly it was Autopilot who made this originally……

  5. ‘@Thanks bro Dedparture! I am so glad to see some awesome IDEAS from you and mostly to see you back!

    Amazing Idea bro. I will def sit work on each part of your ideas that you just gave me. And ofcourse its all about creating something new and better, and If I find that the “Screen Position” method is not helping me in this case then ofcourse I would def do a change. Thank god I have you guys on here, plus all the practice I have had durring this year I am def ready do go for it all the way!

    Thank you for your time explaining so perfectly, and I actually love the Idea about “Name” part in room, to add a timer and message back if not available in room… Thanks bro :pb: Departure

Leave a Reply

You must Register or Login to comment on Reading Last Line – ChatRoomClass to ListBox Problems