Skip to content
Home > Programming > Cant get Text from Room – Crown IM ?

Cant get Text from Room – Crown IM ?

Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #190626
    ChiNa
    Administrator

    Edited, OLD Issue fixed with NickList In Paltalk…

    I have been working on Crown IM for a few days, and what I found out is that sending text in the room is not the same as in Paltalk! Paltalk Uses UNICODE and the API’s are different in Crown IM! But I made that work..

    I made a Greeter for Crown IM that works fine! I am using “Threading” to get the Nicknames (Using the Niclist in ListBox method by Auto-Pilot and String) to a Listbox. The last user entering the room will get a Welcome message… And the reason why I went to use the “Threading” method is because I cannot get ANY Text from the Main room. If I can get the Last Text or LastLine in the room, then I will be able to create an app faster… I tried using the same method used in our Codes for Paltalk, But thats now working for me.. What could be the problem and why is it that I can send text in the room. I dont wanna waste more time If what I was told is completely true about that the Software is made in Delphi, and maybe that could be the cause..

    I will now add the Controls and Classes that I am using right now for Sending Text in Paltalk and Getting Text from the Room in Paltalk. And I am using the same Controls but with different classed in Crown IM to send text in the room. But cant get any text from the main room with these Controls….

    Screenshot of the Room and the Classes plus the Index ID’s,

    This is my “Read Text Code” (Works fine in Paltalk):

    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

     


    Paltalk (Build 523 Beta) Controls:


    #Region “Pal 10 Control defaults”

     

    Public ReadOnly Property MainClass() As String
    Get
    Return "SEINDFELD_SUPERMAN"
    End Get
    End Property
    
    Public ReadOnly Property MainCaption() As String
    Get
    Return "Paltalk Messenger beta"
    End Get
    End Property
    
    Public ReadOnly Property ChatRoomClass() As String
    Get
    Return "DlgGroupChat Window Class"
    End Get
    End Property
    
    Public ReadOnly Property SendTextClass() As String
    Get
    Return "RichEdit20W"
    End Get
    End Property
    
    Public ReadOnly Property ReadTextClass() As String
    Get
    Return "RichEdit20W"
    End Get
    End Property
    
    Public ReadOnly Property SendTextIndex() As Integer
    Get
    Return 1
    End Get
    End Property
    
    Public ReadOnly Property ReadTextIndex() As Integer
    Get
    Return 2
    End Get
    End Property
    
    Public ReadOnly Property SendTextSearchQuadrant() As Integer
    Get
    Return 2
    End Get
    End Property
    
    Public ReadOnly Property ReadTextSearchQuadrant() As Integer
    Get
    Return 2
    End Get
    End Property
    
    #End Region

     

     


    Crown IM Controls)


     

    #Region "Crown IM Constrols - (Originally AutoPilots Paltalk Component Package)"
    
    Public ReadOnly Property MainClass() As String
    Get
    Return "TForm"
    End Get
    End Property
    
    Public ReadOnly Property MainCaption() As String
    Get
    Return "Crown IM"
    End Get
    End Property
    
    Public ReadOnly Property ChatRoomClass() As String
    Get
    Return "TRoomWindow"
    End Get
    End Property
    
    Public ReadOnly Property SendTextClass() As String
    Get
    Return "TsRichEdit"
    End Get
    End Property
    
    Public ReadOnly Property ReadTextClass() As String
    Get
    Return "Internet_Explorer_Server"
    End Get
    End Property
    
    Public ReadOnly Property SendTextIndex() As Integer
    Get
    Return 1
    End Get
    End Property
    
    Public ReadOnly Property ReadTextIndex() As Integer
    Get
    Return 1
    End Get
    End Property
    
    Public ReadOnly Property SendTextSearchQuadrant() As Integer
    Get
    Return 1
    End Get
    End Property
    
    Public ReadOnly Property ReadTextSearchQuadrant() As Integer
    Get
    Return 1
    End Get
    End Property
    
    #End Region

     

    I am pretty sure that I am not Declaring the “SendMessage” right… I have done it all correct so far, and I am able to send text in the room with the Controls after changing a few API’s and Functions.. But I cannot get any text from the room! I am able to get the Titles, Window Names,,, But still not gettin any text from the room. Please Notice that in CrownIM the ChatRoomClass and PMChat has different Classes.

    ChatRoomClass "TRoomWindow"
    PmChatClass "TPMWindow"

    Hope I can get any help troubleshooting the “Get Text” from the room… Thanks a lot in Advance!

    #190642
    Departure
    Member

    You don’t read posts very well, I talked about why Beyluxe and CrownIM are different to paltalk the other topic, First they use a different programming language and second Beyluxe and CrownIM uses a different component to display text than Paltalk, you can’t use GetText ect.. API’s to get the text from this control, Hence the reason Beyluxe included an IPC in there program to help myself and Autopilot out with communicating with beyluxe. Now if CrownIM is using beyluxe source code(which I suspect it is) you might be lucky enough they also have IPC method for communicating included.

    #190641
    ChiNa
    Administrator

    EDITED ADDED NEW SCREENSHOTS:

    hi Bro Dep, I for sure did read you post, and I never miss any of your replies bro, thats for sure. I even replied back but you maybe havtn seen it in here:

    So from your message I understood that it was not possible to get any Text from Beyluxe and Crown IM. My bad bro, But I still wanted to try Crown IM…. Then crown im showed to be different and very easy to get some codings… Now How come I cant get the Content of Child Windows when I can get Content of the Main Windows and everything else in Crown IM.

    Does it mean that we are only able to get “SOME” of the parts in Crown IM, and not all of it?
    Waiting for your reply brow!

    Ps, I have sent you a PM about something funny,,, Please read when you get the time lol

    I have so far created 2 Products that works fine, beside that I need to re-code the Greeter! One is called Auto-Greetor and the other is a Text Flooder and a Chatter—

    Greeter – With Text Sending Options

    Flooder With Text Sending Options:

    #190640
    autopilot
    Member

    @ChiNa-Man wrote:

    Now How come I cant get the Content of Child Windows when I can get Content of the Main Windows and everything else in Crown IM.

    The issue with getting text is the type of control the text is in. Going by your Screenshot above, you are trying to pull text from a “Internet Explorer_Server” control using the techniques used for an edit control. That is like trying to unlock your car door with your house key (it just won’t work).

    I have not looked at Crown, but it may be possible to read the xml from the “Internet Explorer_Server” control and parse the incoming text that way.

    See read browser “in memory HTML” from EXE

    #190639
    ChiNa
    Administrator

    You Rock Auto-Pilot! Thanks for the reply… I will take a look at it right now because I am free today. You can always take a look at Crown IM! I think I made it easy with your codings and your way of getting the nicknames! All worked for me!

    Credits Given as Always!

    #190638
    ChiNa
    Administrator

    Ups, I noticed that I added the ReadTextClass Wrong in my first post:

    Here is the correct one:

    Public ReadOnly Property ReadTextClass() As String
    Get
    Return "Internet_Explorer_Server"
    End Get
    End Property

    In Paltalk its called “RichEdit20W”


    @AutoPilot
    , you got it very quick and already knew that the class is “Internet_Explorer_Server” without even using Crown IM! 😀 Thanks


    Ps, A few Minutes Later (Saw caught the Donate option in your Signature) :

    Dear AutoPilot, I know that a THANKS is not enough, but we at least wanted do so more than a thanks just to show how thankfull we are for all what you have done so far for all our forums and helping people invidually..

    So on behalf of myself, and our Staff on forum China-Cheats.com we Donated 20 US Dollars for your projects and for all what you have done so far.. And to keep it going…. A THANKS and to let you know we are more than thankfulll for what you have done us and everyone else… and for mysel…. I have learned a lot from you..

    I wish we could afford a bit more than what we donated, and say more than just a “Thank you”.

    THANK YOU Auto-Pilot for all these years teaching everyone what you know! God Bless…

    #190637
    autopilot
    Member

    Thanks for taking the time and the willingness to donate your hard earned money. Very few people do so it does mean a lot when someone takes that step.

    I saw in your screenshot you had it labeled as “Internet Explorer_Server”.

    I started working on trying to develop code to read the text from the Internet Explorer_Server and basically, I can copy the Internet Explorer_Server into an IHTMLDocument2 object. From there, I can get the whole chat text into a string object. I currently am playing with loading the string into a richtextbox, but there are other ways we can go about parsing the incoming chat too.

    I will post some code once I get a better handle on the process and clean up my code.

    #190636
    ChiNa
    Administrator

    Np, Auto you deserve everything positive from us and anything than just a Thanks. I have spoken to loco and hopefully he will add a Donate button on here as well so others can also donate a few dollars if its not too much for them..

    I cant wait for you to finish the methods your working with arround the Internet_Explorer_server! I have been searching a bit more but I def think you are more into it than I am because I never tried it befor! Crossing my fingers and wishing you good luck..

    #190635
    autopilot
    Member

    Ok, here is what I have at this point. But using these calls, the program must be run as administrator.

    Add reference to Microsoft HTML Object Library
    [attachment=0:20gd9lvy]Ref_MS_HTML_Object.png[/attachment:20gd9lvy]

    Here is my import section

    Imports System.Runtime.InteropServices
    Imports mshtml

    Here are the API def’s and a function to get text from internet explorer_server

    #Region "API CALLS"
    
    _
    Public Shared Function RegisterWindowMessage(lpString As String) As Integer
    End Function
    _
    Public Shared Function SendMessageTimeout(hwnd As IntPtr, msg As Integer, wParam As IntPtr, lParam As IntPtr, fuFlags As Integer, uTimeout As Integer, ByRef lpdwResult As IntPtr) As IntPtr
    End Function
    _
    Public Shared Function ObjectFromLresult(lResult As IntPtr, ByRef riid As Guid, wParam As IntPtr, ByRef ppvObject As IHTMLDocument2) As Integer
    End Function
    Public Const SMTO_ABORTIFHUNG As Integer = &H2
    Public IID_IHTMLDocument As New Guid("626FC520-A41E-11CF-A731-00A0C9082637")
    
    #End Region
    
    ' Provide Handle of Internet Explorer_Server object
    Private Function DocFromDOM(ByVal hWnd As IntPtr) As String
    ' Create IHTMLDocument2 object
    Dim Doc As IHTMLDocument2 = Nothing
    Try
    ' Get Registered Windows message
    Dim nMsg As Integer = RegisterWindowMessage("WM_HTML_GETOBJECT")
    ' Create IntPtr object to pass as ref to SendMessageTimeout
    Dim ipRes As IntPtr
    ' Call SendMessageTimeout
    If (SendMessageTimeout(hWnd, nMsg, IntPtr.Zero, IntPtr.Zero, SMTO_ABORTIFHUNG, 1000, ipRes) = IntPtr.Zero) Then
    ' SendMessageTimeout returned nothing, make sure IHTMLDocument2 is nothing
    Doc = Nothing
    Else
    ' Call ObjectFromLresult to fill IHTMLDocument2 object
    ObjectFromLresult(ipRes, IID_IHTMLDocument, IntPtr.Zero, Doc)
    End If
    Catch ex As Exception
    ' Make sure IHTMLDocument2 is nothing
    Doc = Nothing
    End Try
    ' Process Doc for return
    If Doc Is Nothing Then
    Return Nothing
    Else
    ' Return the innertext
    Return Doc.activeElement.innerText
    End If
    End Function

     

    Once you get the text, you will still have to parse it to find out what if anything is new.

    #190634
    Departure
    Member

    😉 Good work Autopilot….

    #190633
    Departure
    Member

    Here its working in Delphi

    function GetIETextFromHWND(WHandle: HWND): String;
    var
    hInst: HWND;
    lRes: Cardinal;
    Msg: Integer;
    pDoc: IHTMLDocument2;
    ObjectFromLresult: TObjectFromLResult;
    begin
    hInst := LoadLibrary('Oleacc.dll');
    @ObjectFromLresult := GetProcAddress(hInst, 'ObjectFromLresult');
    
    if @ObjectFromLresult nil then
    begin
    try
    Msg := RegisterWindowMessage('WM_HTML_GETOBJECT');
    Result := '';
    if SendMessageTimeOut(WHandle, Msg, 0, 0, SMTO_ABORTIFHUNG, 1000, lRes) = 0 then
    pDoc := Nil
    Else
    ObjectFromLresult(lRes, IHTMLDocument2, 0, pDoc);
    Result := pDoc.activeElement.innerText;
    finally
    FreeLibrary(hInst);
    end;
    end;
    end;
    
    
    
    And Example usage....
    

    Memo1.Clear;
    Memo1.Lines.Append(GetIETextFromHWND(331440)); //Static Handle from Handle spy..

    Untitled-1

    #190632
    AhFox
    Member

    looks good … congrats.

    #190631
    ChiNa
    Administrator

    @AutoPilot omg, What an awesome job! You are working a total different level. Thank you.

    I have a very few questions about it! The way I got the room ID was using the HWND ID or NR. It seems to change for each time I start the Chat-Software! Am I missing something or maybe adding the codes wrong.. Or there is nothing to do about that….And one last thineg. about the in the GUID Field:

    Public IID_IHTMLDocument As New Guid("626FC520-A41E-11CF-A731-00A0C9082637")

    How did you get the ID or Numbers is it something that is already written for the Code, and is it something thats going to change later on.. ? Thank you very much Auto-Pilot ….

    @NYVE, I think we could create some awesome tools in future for other ChatApps! I am glad that at least me as a newly beginner can get so much great advice, because I already am a member of vBforums and other larger forums that does not covert any of this at all….

    @Bro Dep, Nice job, and the screenshots are very helpfull. Finally we made it!.. I am thinking start programing a bit in Delphi too.. I have a user posting lately in our forums some awsome delphi tutorials, I think you will like it too…….

    #190630
    autopilot
    Member

    The GUID is what the IHTMLDocument interface is registered as. I found it in sample code, but if you open Regedit and search for the GUID, you will find it is registered with the IHTMLDocument interface.
    IHTMLDocument

    #190629
    ChiNa
    Administrator

    Thank you very much Auto-Pilot! I have so much to learn yet, and honestly NET and C does never stop surprising me! I am blessed to have good people like yourself to advice us! God bless !

Viewing 15 posts - 1 through 15 (of 17 total)
  • You must be logged in to reply to this topic.