Results 1 to 14 of 14

Thread: Windowless Rich Edit Text Box

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2005
    Posts
    23

    Windowless Rich Edit Text Box

    Hey...I'm in the process of making an WLM add on which will run like an MSN bot. It will have all the commands that an MSN bot will have but the user will also be able to talk to the people on their contact list.

    So far i have managed to hook the MSN and add my own sub menu. And i have managed to hook winsock to detect when a message is received. But i'm having a problem trying to send a message. I don't want to use the API because it uses the SendKeys function which is a bit tacky.

    I know that the input text box is a windowless rich edit text box and i was wondering how i can actually hook it and input text to it. If thats not possible could someone give me an example of how i could do the same thing with Active Accessibility?

    Thanks in advanced.

  2. #2
    Hyperactive Member
    Join Date
    Jun 2006
    Posts
    372

    Re: Windowless Rich Edit Text Box

    there is a meesenger client example in the codebank section.
    might be worth a peek...

  3. #3
    Old Member moeur's Avatar
    Join Date
    Nov 2004
    Location
    Wait'n for Free Stuff
    Posts
    2,712

    Re: Windowless Rich Edit Text Box

    You can't hook windowless controls since they are not windows and don't have a message queue.

    All the messages are handled by the container so you'll have to hook the containing window.

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Nov 2005
    Posts
    23

    Re: Windowless Rich Edit Text Box

    Hey moeur, by containing window i take it you mean the whole conversation window? If so i have managed to hook that already and add a sub menu. But i am unsure of how to send Text to the input box? Is it possible you could point me in the right direction? Thanks.

  5. #5
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654

    Re: Windowless Rich Edit Text Box

    Wouldn't you just need to spy what messages are going out when you write a message? One of them ought to be the message that contains the outgoing message (a pointer to string or a pointer to structure that contains pointer to string).

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Nov 2005
    Posts
    23

    Re: Windowless Rich Edit Text Box

    I dont want to detect when i write a message. I want to make my program automatically respond if someone types !help for example.

  7. #7
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654

    Re: Windowless Rich Edit Text Box

    I didn't mean that. I meant that by sniffing how the MSN window works you will know what message to send and where to send if such message is outputted from the window elsewhere; and then code based on that. So you don't need to access the richtextbox at all to send text.

  8. #8

    Thread Starter
    Junior Member
    Join Date
    Nov 2005
    Posts
    23

    Re: Windowless Rich Edit Text Box

    How would i sniff how the MSN window works?

    I tried sniffing the packets but they dont seem to have a pattern:

    When i receive a message the packet is this:

    Code:
    MSG [email protected] -={TWM}=-_Jaffa_Cake 133
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    X-MMS-IM-Format: FN=Microsoft%20Sans%20Serif; EF=; CO=0; CS=0; PF=22
    
    ?
    The question mark being the message i receive and the email address being who i receive it from. Thats completly logical.

    But, when i send a message the packet is:
    Code:
    MSG 177 N 145
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    X-MMS-IM-Format: FN=MS%20Shell%20Dlg; EF=; CO=0; CS=0; PF=0
    
    Hey
    Now...the numbers in the MSG section always change even if it is to the same person so how does it know where its going? :s

    However, i'm hoping your suggesytion of sniffing the window will tell me exactly what i need to do? It's just i never heard of sniffing another applications actions? :S

  9. #9
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654

    Re: Windowless Rich Edit Text Box

    Well, I once sniffed how mIRC worked, although differently: I just made the program connect to my own "proxy" program that displayed all the messages mIRC sent and received. I did this to know how the most popular program does traffic handling so I could duplicate the behaviour in my own program to ensure compatibility with most IRC servers.

    Anyways, that was just an example. By sniffing what the other program does you can duplicate the behavior. However, I got another suggestion: take a look at MSN client done by Wokawidget, Badger Messenger. I believe you'll find the information you need by taking a look at how that program works.

  10. #10
    Old Member moeur's Avatar
    Join Date
    Nov 2004
    Location
    Wait'n for Free Stuff
    Posts
    2,712

    Re: Windowless Rich Edit Text Box

    I don't know how you are going to communicate with the windowless control from outside the program that created the control. Certainly not from VB.

    Windowless controls communicate with their container using a two-way system of event firing and exposing methods and properties to the container.

    You'll have to investigate the MFC interfaces involved to see if this system can be tapped into via C++. Look up:
    COleControl Class
    Windowless Controls
    IOleInPlaceObjectWindowless

  11. #11

    Thread Starter
    Junior Member
    Join Date
    Nov 2005
    Posts
    23

    Re: Windowless Rich Edit Text Box

    I have found an example on the net which uses Active Accessibility. But at the moment i keep getting the error Object Required and im not sure why.

    I would appreciate it if someone could have at look at it. Thanks
    Attached Files Attached Files

  12. #12
    Old Member moeur's Avatar
    Join Date
    Nov 2004
    Location
    Wait'n for Free Stuff
    Posts
    2,712

    Re: Windowless Rich Edit Text Box

    On what line do you get the error?

    Check Project/References and make sure you have Accesibility checked

  13. #13
    Old Member moeur's Avatar
    Join Date
    Nov 2004
    Location
    Wait'n for Free Stuff
    Posts
    2,712

    Re: Windowless Rich Edit Text Box

    I found a problem in the code. Change this routine
    VB Code:
    1. Private Sub cmdTest_Click()
    2.     If lstContacts.SelCount = 0 Then Exit Sub
    3.     If lstContacts.Text = "<All>" Then
    4.     Else
    5.         Dim hwnd As Long
    6.         Dim hwnd2 As Long
    7.         hwnd = Val(Left(lstContacts.Text, InStr(lstContacts.Text, " - ") - 1))
    8.         hwnd2 = FindWindowEx(hwnd, 0, "BrowserFrameGripperClass", vbNullString)
    9.  
    10.         Dim lngTMP As IAccessible
    11.         Call AccessibleObjectFromWindow(hwnd2, OBJID_CLIENT, IID_IAccessible, lngTMP)
    12.         If lngTMP Is Nothing Then
    13.         Else
    14.             Dim iTMP As IAccessible
    15.             Dim lngTMP2 As Long
    16.             Set iTMP = lngTMP.accParent
    17.             Dim lngCount As Long
    18.             lngCount = iTMP.accChildCount
    19.             Dim accChildren() As Variant
    20. [hl]            ReDim accChildren(1 To lngCount)
    21.             Call AccessibleChildren(iTMP, 0, lngCount, accChildren(1), lngTMP2)
    22.             Dim lngCount2 As Long
    23.             For lngCount2 = 1 To lngCount[/hl]
    24.                 lstIObjects.AddItem accChildren(lngCount2).accName(CHILDID_SELF) & ":" & accChildren(lngCount2).accValue(CHILDID_SELF)
    25.                 If accChildren(lngCount2).accName(CHILDID_SELF) = "Input" Then
    26.                     accChildren(lngCount2).accValue(CHILDID_SELF) = "You see this so you know it's working!"
    27.                 End If
    28.             Next
    29.         End If
    30.     End If
    31. End Sub

  14. #14

    Thread Starter
    Junior Member
    Join Date
    Nov 2005
    Posts
    23

    Re: Windowless Rich Edit Text Box

    Thanks, I really appreciate it. I'll let you know how i get on later

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width