How to get a reaction on a Recieved PM?

Hi Everyone.. To our Developers and friend:

I am making a new Tool using (vBNET 2010), but I am kinda stuck in the middle of it all! I wanted to create an Auto-Responder sendt in PM! Just like we had in Balool! The Balool Auto-Responder was working when the “AWAY” function was activated in Pal whenever I recieved a PM message, it will then respond back to the person using the same PM Window!

Thanks to Loco I managed to create the Status and Away functions, and I also managed to create a Text Sender using Auto-Pilots Method, but without the PalRoomSelector.dll.

My Question Starts here:
I am now stuck on the “PM WINDOW” part.

How can I get a “reaction” on a recieved message in pm, and most importantly how to make sure that my responder or text will be sent using the exact PM window that I am recieving the PM from!

I hope i could some help with this now after 2 weeks of hard work! I still cant figure it out.
Many thanks in advance,,

59 thoughts on “How to get a reaction on a Recieved PM?

  1. Thanks for the Reply Chike, I did try that but still not sure If I did declare it right.. I will def going to give it one more try. Crossing my fingers.

    EDITED AGAIN:
    Can I get some help with the declaration of GetWindow Text please. Just not sure if I did it right the first time…

  2. @String wrote:

    I just noticed that Autopilots room selector dll gets the title of open pm windows. So within that source would be an example of how to do it.

    Right on time String. I did try check the Palroomselector dll, but I was thinking to do it more simpler!
    I will check it right now.. Thanks String

    Ok Back a few minutes Later. I think I will then have to use the PalRoomselector anyways! As I explained on my first thread was that I was not using the PalroomSelector, but I think If I have to create and AutoResponder I might need the RoomSelector dll for now untill I figure out to do it without the roomselector dll.. We can consider this one Solved for now..

    My next step is to create an Auto-Responder, and If you have any Ideas for me to put in to work I would be appreciated. Thanks a Bunch Chike and String.

  3. Title is the text in title bar, like rooms have ” – Voice Room” or ” Private Room” in it, PM window only has the PMer name in it.
    GetWindowText is the function to get the title.

  4. don’t use no dll, write your own code, it’s how you learn.

    I would create a a list of structure of window handle and title.
    Use FindWindowEx to iterate through all pm/room windows.
    Add only windows that are not room windows to the list.
    Than you are ready for your reaction.

  5. @Chike wrote:

    Isn’t it more simple just to check the room title to tell if it’s IM window?

    I actually did think about using the Titles but in this case does a PM WINDOW have a title? If yes, then I cant seem to find anything related to a PM Window Title. And I dont think its called “Private Room”. Is there a way to find the title, because I cant seem to get a Title of a Pm Window. But the Idea is great, thanks

    @String wrote:

    I don’t know if it is simpler, but yes that would certainly be another way to do it. The only problem I would foresee would be if there were other DlgGroupChat Window Class‘s that were present that had neither the “Voice Room” or “Private Room” in their title, but were not a PM window either.

    I agree String… I cant really find anything related that can get me a Title on a PM Window. Ps, I am still working on your method… Thanks mate

  6. Hi Chike, 😀 Am not the best guy when It comes to explanations. My Bad.

    My Question is, How can I set my program to read text that I recieve in my pm…… And in this case I am not talking about Reading Last lines etc…

  7. @ChiNa-Man wrote:

    How can I get a “reaction” on a recieved message in pm, and most importantly how to make sure that my responder or text will be sent using the exact PM window that I am recieving the PM from!

    You would do it the same way you find the chat room window and text.
    You could do something like this:

    In a timer, watch for a window with the class name DlgGroupChat Window Class.

    If you find that class name, check to see if that window contains the control CwndIMVideoBar. Only a pm window will have this particular control.

    Now that you can reasonably assume that you have a pm window, Get the windows title, text send box and text read box the same way you do with the room window.

    You can then send text(a response) to that particular window.

    You can also get the text in the pm the same way as in a room. It is a richtextbox control.

  8. @String wrote:

    If you find that class name, check to see if that window contains the control CwndIMVideoBar. Only a pm window will have this particular control.

    @String, Very usefull method, I never thought doing it this way, and I am going to create a reaction using your method and see if that will work out! I understood everybit of it and thank god the past 2-3 weeks I got to know each Window Classes in Paltalk! Now it will be easier for me to at least have a plan.

    @Chike, How to check if its a room title or pm. That never crossed my mind neither..? A short explanation could be very usefull to where I am right now… thank you

  9. You guys make anything POSSIBLE.. Thanks a lot

    @Chike ohh my bad, I tried at least explain a bit about it and below will be a bit more explanation about how it should work.

    @ String, Yes I am using the find window still. And the first code you provided me helped me to change my approach towards it, and now you just nailed it with the new code along side Chikes amazing work!
    THANKS A LOT Buddy! It works awesome.

    I added a Textbox and called the function with a Button while pm was open.. Worked first time..

    A bit more about the Auto-Responder, If I didnt explain correctly:

    1st part of the Auto-Responder should be active ONLY when the user is on AWAY Status. Thats why I added the Status options to the project. Then the Auto-Responder has to run while Paltalk is on ofcourse.

    2nd main thing is that it should only reply on NEW PMS recieved! So if I recieve a 2nd message in my PM while the PM window is open, then it should not response, And honestly I know it it will be a hard thing to create a response ONLY when a PM WINDOW gets openned, With your advice I will for sure take the best way out! Thanks for the code, it has helped me a lot and inclusive the last part String added is now complete. I got a full functional PM TITLE READER. Works awesome!

    Now my next goal is to create and Auto-Respond using a timer and I know it will be hard, but I am determind to finish it ! I had lots of great support from you guys, and I def put an update each step of my project!

    BIG THUMBs UP Chike and String 😳

  10. @Chike wrote:

    Isn’t it more simple just to check the room title to tell if it’s IM window?

    I don’t know if it is simpler, but yes that would certainly be another way to do it. The only problem I would foresee would be if there were other DlgGroupChat Window Class‘s that were present that had neither the “Voice Room” or “Private Room” in their title, but were not a PM window either.

  11. ‘@ Thanks String, Cant Wait either till its finished… But ;D may take me months to finish hahaha

    @ Chike, I def agree with you and I have this attitude also by doing it my way! I mean usually as LocoHacker knows I dont ask for help no matter who lost I am, but as a great man like Palol teached was to simply ASK. I still I dont like to give up and I always like to do my own thing and in my own way.. Thanks for your awesome advice. You give me motivation to keep going and going. I was really tired of digging for 2 weeks, thats when I decided to come and ask for help, and now you guys are making it more worth digging and working harder! I appereciate all your advice, and I wont miss any of it… And for the code you provided just like String, its an Awesome peaece and I found many of my mistakes, So thanks for that… And befor saying thanks again, I wanna ask 2 newbie questions!

    1) Do I still have to use the find “Window” class method? And maybe attach your code into it… Or should woek on your code and simply delete the find “Window” by class method?

    2) If I use the little peace of code you provided, how can I make it send the PM TITLE (ONLY) to a TEXTBOX?

    In my opinion your code is complete, and I dont think I will have to use and “find window class” , But I still wanna hear your advice.. Thank you

  12. @ChiNa-Man wrote:

    You guys make anything POSSIBLE.. Thanks a lot

    @Chike ohh my bad, I tried at least explain a bit about it and below will be a bit more explanation about how it should work.

    @ String, Yes I am using the find window still. And the first code you provided me helped me to change my approach towards it, and now you just nailed it with the new code along side Chikes amazing work!
    THANKS A LOT Buddy! It works awesome.

    I added a Textbox and called the function with a Button while pm was open.. Worked first time..

    A bit more about the Auto-Responder, If I didnt explain correctly:

    1st part of the Auto-Responder should be active ONLY when the user is on AWAY Status. Thats why I added the Status options to the project. Then the Auto-Responder has to run while Paltalk is on ofcourse.

    2nd main thing is that it should only reply on NEW PMS recieved! So if I recieve a 2nd message in my PM while the PM window is open, then it should not response, And honestly I know it it will be a hard thing to create a response ONLY when a PM WINDOW gets openned, With your advice I will for sure take the best way out! Thanks for the code, it has helped me a lot and inclusive the last part String added is now complete. I got a full functional PM TITLE READER. Works awesome!

    Now my next goal is to create and Auto-Respond using a timer and I know it will be hard, but I am determind to finish it ! I had lots of great support from you guys, and I def put an update each step of my project!

    BIG THUMBs UP Chike and String 😳

    sounds like a good idea …. I’ve been thinking of this one before … but don’t have time to do it 🙂

  13. ‘@String my man, Thanks buddy that would def save me for lots of work! 😳
    I now realised I was doing it all wrong when I was creating the function for the FindWindow method 🙁

    @Chike, you def right and my plan was also not to use any dlls. But since I gave you guys 2 days of headache asking I decided to go with the dll untill I found a solution! Thanks for your advice, even tho I do not wanna use the dll now I do as you guys adviced me. Going for my own structure.

  14. I am positive your codes doesnt have errors.. It was my fault! I was trying to fit my TEXT SENDER into the timer, and didnt realise that I also added a “RichTextBox.Text” as a Text to be sent, inside the same time! So 2 Text Sending options in 1 Timer.. My bad..

    About the last code, the menu bars visibility, I will have to read a bit more about last the codes you sent me.. Still newbie, but have learned a lot!

    And_______Some thing I appreciate the last couple of days:

    I experienced like 2 weeks ago I asked for help in one of the biggest vB forums about some help that had to do with Paltalk! I got an answer, and the answer was not only from 1 person! I got the same answer from all the top Posters with the highest Reputations in that forum. All of them had more than 4.000 post counts.

    They said Paltalk has thausands of Menus, Bars and Windows. Plus you will have to create the API yourself.

    So basicly their answer was a NO, because they were not going for something that hard.

    I have now realised that I am learning from the BEST. Which is you guys on here! I appreciate every single line! And I am getting it to myself with a broken english 😀 .. Thank you Chikeeeeeeeeee. Hats off for all the hard work you put in for us New runners.

  15. @Chike wrote:

    How did I make you feel so far away?
    All I said that software is build in 3 stages, first is defining the requirements, then algorithm design, and then coding.
    Of course you need to be familiar with coding and the options you would have to implement the software to have a good design.
    It seems you know the options for implementation, you have the requirments, now yuou need the algoritm (in plain language) and then off to final coding.

    Honestly, the first feeling was just that I felt EMPTY minded loool. And 2nd I feel a bit embarassed of giving you guys headache. I am still so new to this. But I always I read all your messsage twice or at least 3 times! Then I do my research! As loco knows I am very fast learner, and I am having you guys on here, so I feel awesome about it now. I feel that anything is possible, tho I have no idea about the alorithm part hhahahah. 😳 Thanks a bunch Chike

  16. @Chike wrote:

    On the contrary, it is a quite wasy task, all you need is to figure out the plan.
    Obviousely, the PM title has no significance for this task, only the window handle.
    All you need is to keep track of windows you have responded to. Easy no?
    It gets more complicated when you close pm windows the responder responded to, but that can be left for later.

    Hi Chike. Thanks a lot for the response mate. What would I do without you guys advice….

    The titles were mainly because I wanted it as my KEY to create a response. I was thinking to create a Timer and using the Window Titles as my KEY. I got this IDEA first because of Balool which had this amazing Responder when a person was Away. The next is the Skype Tool I created not long ago! But never got it Published because some of my friends got errors, and The Skype – Auto Responder is very simple! You start it and then its set to answer back no matter what.

    But now the Paltalk will be more special, l becuase I want it only to respond when I am on AWAY Status.
    Below is the Skype Tool I posted today.. It is really haunting me with this weird error..

    Skype Auto-Responder: https://www.imfiles.com/post95974/#p95974

    The Errors I get: https://www.imfiles.com/error-when-debug-or-run-as-administrator-t43491/

  17. @Chike wrote:

    The statud i am not sure, it can be fount in the status menu in main paltalk window, but the menu is not always visible, so leave it for later.
    was_away can be a boolean member of the class, changed every time that its needed.

    Hi Chike, Thanks for a quick Response… I got all the Status functions done and ready! Looking for an option that can lead from “If Away” to “If Pm Window Open”…. Only the last part is what will cause me time going to.

    Timer also ready, Hopefully I done it right! Trying to work even hard now to create the last part. Thx again Chike

  18. The statud i am not sure, it can be fount in the status menu in main paltalk window, but the menu is not always visible, so leave it for later.
    was_away can be a boolean member of the class, changed every time that its needed.

  19. @String wrote:

    If I understand correctly, It’s easy to know when you are Away since you change your status to Away via your own program.
    So, In your timer :
    If Away = True Then
    Code for logging open pm’s or “remembering” them.
    End If

    If he rely on changing status himself there is no need for the if.
    Remember pms and activate the timer when changing status to away, deactivate timer and forget pms when changing status to other.

  20. I’ll try to help here, but I’m not really sure where your at or what your question is exactly.
    @ChiNa-Man wrote:

    And this is where I am stuck:
    Code: Select all
    if status is away:
    if wasn’t away before: remember all openned PM

    If I understand correctly, It’s easy to know when you are Away since you change your status to Away via your own program.
    So, In your timer :
    If Away = True Then
    Code for logging open pm’s or “remembering” them.
    End If

  21. How did I make you feel so far away?
    All I said that software is build in 3 stages, first is defining the requirements, then algorithm design, and then coding.
    Of course you need to be familiar with coding and the options you would have to implement the software to have a good design.
    It seems you know the options for implementation, you have the requirments, now yuou need the algoritm (in plain language) and then off to final coding.

  22. @Chike wrote:

    So maybe it will be more than 10 lines of code, but less than 20.
    If you use GetPMWindows as I first proposed, there is no extra work to do to “remember” the answered pms, after you done the respond part, the entire list can be saved as pms that were responded to.

    Good lord, I musta have done something good in life! Thanks a lot I will go to work immediately… And let you know how and where i came too.. I might ask a few questions about the timer… But so far So good Chike… Thanks Bro

  23. I wasn’t talking about code.
    What does the responder is need to do, and how it is going to do it.
    e.g. is it going to responde to a PM only once or every time a new text is posted in it, is it going to close the PM or not, those kind of things.
    It is inportant to know what is it you are going to do before you begin coding, then you can design the data structures that would be needed, and then the way it is going to be implemented, only after you figure all those out you should begin coding.
    Design is maybe the most important stage in software development, coding is only technical.

  24. @Chike wrote:

    You can also post the requirements of the responder, design. data structures you intend to use and program flow. for a review.

    I have arround 2-3d ifferent methods and codes that you guys have helped me with. So short said I have not even a Start-code for the “Get PM Title” or “Get Window” title part, so I can create and AUTO RESPOND first and then the rest of my tool.

    So far I have created 2 parts that I wanna include in my project, They are all created peace by peace and will be used in a single project! (Auto-Responder)

    Here is a little description of the things I have created so far to include in my project:
    1) A Text-Sender that I created (1 Button, 1 TextBox) only! Can send text to PM and ROOM.
    2) A Status Tool (Offline, Online, Away and Invisible) 4 Btn’s (Ps, Got lots of help from LocoHacker with that)

    3) (HERE I AM I) I am working on to create an AUTO-RESPOND method by getting the PM TITLE as you guys have adviced me… So this is all I’ve got. (Just not any start code for the 3rd method).

  25. @ChiNa-Man wrote:

    The titles were mainly because I wanted it as my KEY to create a response.

    A key for what? The window handle is a very good key if you need it to track windows you have already responded to, the titles may change ,away/offline/dnd are addded when user status change.

    As for the PM windows logic you are about <10 lines of code away,

  26. @ChiNa-Man wrote:

    You guys make anything POSSIBLE.. Thanks a lot

    2nd main thing is that it should only reply on NEW PMS recieved! So if I recieve a 2nd message in my PM while the PM window is open, then it should not response, And honestly I know it it will be a hard thing to create a response ONLY when a PM WINDOW gets openned, With your advice I will for sure take the best way out! Thanks for the code, it has helped me a lot and inclusive the last part String added is now complete. I got a full functional PM TITLE READER. Works awesome!

    On the contrary, it is a quite wasy task, all you need is to figure out the plan.
    Obviousely, the PM title has no significance for this task, only the window handle.
    All you need is to keep track of windows you have responded to. Easy no?
    It gets more complicated when you close pm windows the responder responded to, but that can be left for later.

  27. GetPMWindows functions retrive the list of all open PMs.
    How to know if you have a new pm? If it’s not in the list you got from GetPMWindows last time.
    One saved list, a new list, “for each” loop. and “if” statement, that’s all it takes.

  28. @Chike wrote:

    GetPMWindows functions retrive the list of all open PMs.
    How to know if you have a new pm? If it’s not in the list you got from GetPMWindows last time.
    One saved list, a new list, “for each” loop. and “if” statement, that’s all it takes.

    Hi Chike.. OK, Now I did the last part to create the AUTO “REPLY” so it can reply everytime. I can now send text to PM with either with a button click, or below a timer etc. But still stuck to create an AUTO-RESPONSE using a Timer or the GetPMWindows automatically when a pm gets ..I think I need some help with this last part :s and then Im officially done.

  29. @Chike wrote:

    @ChiNa-Man wrote:

    The titles were mainly because I wanted it as my KEY to create a response.

    A key for what? The window handle is a very good key if you need it to track windows you have already responded to, the titles may change ,away/offline/dnd are addded when user status change.

    As for the PM windows logic you are about <10 lines of code away,

    😀 First you made me think (Am I that wrong 😀 and so far away)… And then I saw the “10 Lines away”,, Made me feel good :! Thanks I would work hard on it Chike

  30. @Chike wrote:

    The menu tricks are mostly windows programming which I did up to 10 years ago, you cannot expoect just any programmer to know them, and I myself had to do some re-reading to find what I knew is there.
    Paltalk is making more use of custom classes which make it more difficult to create add-ons.
    Read tyhe about menus. lots of entries there but they are all dundonental to undestand how can you do things, and you don’t have to fo it all in one day, take your time.
    And BTW I’m quite sauced, so bear with any typos I have made.

    I am just amazed… Actually while reading your reply am sitting and looking at it trying to make it fit with my old work! And as you said I am also taking my time on it.. Appreciate your time Chike for doing this. Soon when I finish the Auto-Responder will def post a few details about it, and I think I will use some color faders and some other special addons too instead of just text-messaging…. 8)

  31. Well GetPMWindows need to be declared as i first posed it. either as a method of the form class or a public function in a module.
    You cannot declare oldPMs inside Away_Click, it must be a member of the form class.

  32. About Well GetPMWindows need to be declared as i first posed it.

    Thanks for fast response.

    Ups, Edited again.. The GetPMWindows, is already declared. But I did it totally wrong.. I posted it just like your first post and then changed it.. My BAD.. Thanks that is fixed.

    You cannot declare oldPMs inside Away_Click, it must be a member of the form class.

    Yeh and that was what I did first time put it as a form class, but then i changed my mind.
    Thanks Chike. Let me try again then if i am blocked i will ofcourse ask.

  33. hi Chike, Great job. Works awesome!… I was trying to put the “call” below in my timer to executer my Text-Sender to send a text! But dont know how to make it RESPOND one time! As it starts flooding. I have had the same problem when I was creating my txt-sending products! I think this will help me a lot to figure out how to send text only once using the timer!

  34. orhh no, The other code is working awesome, and I think I am going to use that for the release Chike.. Thanks a lot bro.I was talking about the Last part…. The last code you pasted! I tried to create a clean application without using any timer..

    This is the Call I was talking about:

    I added the Send.Keys(TextBox1.Text) Just for testing, because i was at work and had none of my Text-Sending apps or codes with me. So I went for a simlpe SendKeys Method.

    And I think its because I used the SendKeys Method instead of using my own Sender… I dont know didnt try again!I will try with my own simple Text-Sending method! And ofcourse no timer was used..I dont know what I am doing wrong..

  35. The menu tricks are mostly windows programming which I did up to 10 years ago, you cannot expoect just any programmer to know them, and I myself had to do some re-reading to find what I knew is there.
    Paltalk is making more use of custom classes which make it more difficult to create add-ons.
    Read tyhe about menus. lots of entries there but they are all dundonental to undestand how can you do things, and you don’t have to fo it all in one day, take your time.
    And BTW I’m quite sauced, so bear with any typos I have made.

  36. Awesome, I forgot about the previouse explanations .. Now i can see the total meaning.. I will take a look again and again as I always do. I def let you guys know about the updates. And so far so good Chike. Below is an Image of how far I have come.

    I dont wanna crowd this more than the 8 buttons I have implemented! It still only has to be an auto-responder :D! I also created a fully functional inbuilt Text-Sender as well! It can send Text in the room and in PM-Chat, and ofcourse without any Room Selector or any dll…

    Thanks to you and String I managed do the last part without any dll. Hats off for you guys! Incl. Locohacker a lovely person who helped me with the Away Status..etc.. as he always does.

  37. Here is a function that will get the title of any DlgGroupChat Window Class ( pm or chatroom )

     Public Function FindWindowsTitleText() As String
    Dim strbuilder As New StringBuilder(1024)
    Dim PalClass As String = "DlgGroupChat Window Class"
    Dim hWndMain As IntPtr = FindWindow(PalClass, vbNullString)
    
    GetWindowText(hWndMain, strbuilder, strbuilder.Capacity)
    Return strbuilder.ToString
    
    End Function

     

  38. It is realy not that dufficult, don’t be afraid to write code, fail and learn is the way to go.
    Look at the code examples you can find in the forum, but try not to hust copy and paste all of it, even though it’s a method that saves time, compilation errors and time.
    Try to improve the code you find
    And most of all don’t worry about asking questions, at most you will not get an answer
    Here is an example to find all pm windows:

    Declare Auto Function FindWindowEx Lib "User32.dll" _
    (hwndParent As IntPtr, hwndChildAfter As IntPtr, ByVal lpszClass As String, ByVal lpszWindow As String) As IntPtr
    
    Declare Auto Function GetWindowText Lib "user32.dll" _
    (ByVal hWnd As IntPtr, ByVal lpString As StringBuilder, nMaxCount As Integer) As Integer
    
    Public Function GetPMWindows() As List(Of IntPtr)
    Dim pmList As New List(Of IntPtr)
    Dim sb As New StringBuilder(256)
    Dim hWnd As IntPtr = IntPtr.Zero
    
    While True
    ' find window on desktop after hwnd, sero mean first
    hWnd = FindWindowEx(IntPtr.Zero, hWnd, "DlgGroupChat Window Class", vbNullString)
    If hWnd = IntPtr.Zero Then Exit While ' no more windows
    sb.Length = GetWindowText(hWnd, sb, sb.Capacity)
    Dim str As String = sb.ToString()
    If str.Length = 0 Or str.EndsWith(" Room") Then Continue While ' continue ro next window if error or room window
    pmList.Add(hWnd)
    End While
    Return pmList
    End Function

    You may choose to make a subrutine that instead of returning a list process each pm window as it is found, analyze and respond, depend on the complexity of your responder.

  39. @ChiNa-Man wrote:

    1) Do I still have to use the find “Window” class method? And maybe attach your code into it… Or should woek on your code and simply delete the find “Window” by class method?

    2) If I use the little peace of code you provided, how can I make it send the PM TITLE (ONLY) to a TEXTBOX?

    Your still using FindWindow, only its FindwindowEx.

    I modified Chikes code a bit and made it into a Sub. It Adds all open pm windows Title and Handle to a listbox titled Listbox1.

    Just call the GetPMWindows sub and it will populate the listbox with any open pms

    Public Sub GetPMWindows()
    Dim sb As New StringBuilder(256)
    Dim hWnd As IntPtr = IntPtr.Zero
    
    While True
    ' find window on desktop after hwnd, sero mean first
    hWnd = FindWindowEx(IntPtr.Zero, hWnd, "DlgGroupChat Window Class", vbNullString)
    If hWnd = IntPtr.Zero Then Exit While ' no more windows
    sb.Length = GetWindowText(hWnd, sb, sb.Capacity)
    Dim str As String = sb.ToString()
    
    If str.Length = 0 Or str.EndsWith(" Room") Then Continue While ' continue to next window if error or room window
    
    If Not ListBox1.Items.Contains("WinTitle - " & str & " WinHandel - " & hWnd.ToString) Then
    ListBox1.Items.Add("WinTitle - " & str & " WinHandel - " & hWnd.ToString)
    End If
    
    End While
    
    End Sub

     

  40. Form member

    Dim oldPMs as List(Of IntPtr)

    When changing to away

    oldPms = GetPMWindows()

    In timer

    Dim pms As List(Of IntPtr) = GetPMWindows()
    
    For Each pm As IntPtr in pms
    if Not oldPms.Contains(pm) Then
    respone(pm)
    End If
    Next
    
    oldPms = pms

     

    I have once posted code to extract commands from menu, it can be used to detect away status by checking if the away menu item is checked, but that will force the menubar in main paltalk list to be visible.

  41. The folloeing code check the away status in paltalk, as I said before it require the menu bar to be visible.
    external declerations

    ' menus
    Structure RECT
    Dim left As Int32
    Dim top As Int32
    Dim right As Int32
    Dim bottom As Int32
    End Structure
    Structure MENUBARINFO
    Dim cbSize As Int64
    Dim rcBar As RECT
    Dim hMenu As IntPtr
    Dim hwndMenu As IntPtr
    Dim fBarFocused As Boolean
    Dim fFocused As Boolean
    End Structure
    
    Declare Auto Function GetMenuBarInfo Lib "user32.dll" _
    (hwnd As IntPtr, idObject As Long, idItem As Long, ByRef pmbi As MENUBARINFO) As Boolean
    
    Private Declare Auto Function GetMenu Lib "User32.dll" _
    (hWnd As IntPtr) As IntPtr
    
    Private Declare Auto Function GetSubMenu Lib "User32.dll" _
    (hMenu As IntPtr, nPos As Integer) As IntPtr
    
    Private Declare Auto Function GetMenuState Lib "User32.dll" _
    (hMenu As IntPtr, uId As UInteger, uFlags As UInteger) As UInteger
    
    Private Declare Auto Function GetMenuItemID Lib "User32.dll" _
    (hMenu As UInteger, nPos As Integer) As UInteger
    
    Public Const MF_BYPOSITION As UInteger = &H400
    Public Const MF_BYCOMMAND As UInteger = &H0
    Public Const MF_CHECKED = &H8
    Public Const MF_DISABLED = &H2
    Public Const MF_GRAYED = &H1
    Public Const MF_HILITE = &H80
    Public Const MF_MENUBARBREAK = &H20
    Public Const MF_MENUBREAK = &H40
    Public Const MF_OWNERDRAW = &H100
    Public Const MF_POPUP = &H10
    
    Public Const FAILED As UInteger = &HFFFFFFFFUI ' -1
    
    Public Const WM_ENTERMENULOOP As UInteger = &H211
    Public Const WM_INITMENU As UInteger = &H116
    Public Const WM_INITMENUPOPUP As UInteger = &H117
    
    
    The function
    

    Public Function IsAway(pal_wnd As IntPtr)
    Dim hmenu As IntPtr = GetMenu(pal_wnd)
    If hmenu IntPtr.Zero Then
    ' this is trick to fool paltalk to think menus are about to show
    ' and update checkmark
    Call SendMessage(pal_wnd, WM_INITMENUPOPUP, hmenu, 1)
    hmenu = GetSubMenu(hmenu, 1) ' get Actions sub menu
    Call SendMessage(pal_wnd, WM_INITMENUPOPUP, hmenu, 0)
    hmenu = GetSubMenu(hmenu, 0) ' get status sub menu
    Dim status As UInteger = GetMenuState(hmenu, 1, MF_BYPOSITION) ' get Away item status
    Return (status And MF_CHECKED) 0
    End If
    Return False
    End Function

    
    call the function
    

    Dim pal_wnd As IntPtr = FindWindow("SEINFELD_SUPERMAN", vbNullString)
    if IsAway(pal_wnd) Then
    ' do something
    End If

     

  42. I tried it , and I get that “not recognised” error on “GetPMWindows()”

    And I was using the code below to find each TITLE first and then send my richtextbox message:

    If CheckBox1.Checked = True Then
    If str.Length = 0 Or str.EndsWith(" Room") Then Continue While
    If Not ListBox1.Items.Contains("Title - " & str & "" & hWnd.ToString) Then
    Do Until ListBox1.Items.Contains("Title - " & str & "" & hWnd.ToString)
    Loop
    System.Windows.Forms.SendKeys.Send(RichTextSend.Text)
    End If
    End If
    End While
    End Sub

    Thank you very much Chike… I havnt done my homework yet 🙁
    Owe you guys..

  43. Hi, Back.. And guess what Chike.. It worked finally… Just an error I got on this line here, but can be fixed! I came to let you know! But will tell a bit about the error also:

    And the error I get is on this line:

      if Not oldPms.Contains(pm) Then

    So this is the line for the timer you sent me:

    Dim pms As List(Of IntPtr) = GetPMWindows()
    
    For Each pm As IntPtr in pms
    if Not oldPms.Contains(pm) Then
    respone(pm)
    End If
    Next
    
    oldPms = pms

    And instead of line “Response(pm)” I added my TEXT SENDER options.
    And the error that I get is only when my the PM gets open. But it does send the message first to the pm.and then I get the yello error and the application closes, Still on debug. I think I can fix that.

    You and String have done an amazing job, and specially now on this last part! Worked the first time!
    Now back to fix the problem! I will let you know Chike…. Thanks Chike

  44. The requirements:
    1. responde while in a way mode only.
    2. responde to new PMs only.

    For now assuming that any PM that is already open when changing status to away, or when the program is started, should

    not be responded to.
    You also mentioned a timer.
    So the algorithm, or flow of the program would be.
    periodically do:
    if status is away:
    if wasn't away before: remember all openned PM
    if was away before: respond to every PM you have not responded to, and remember you did
    if status is not away:
    remember it

    and pseudo code:

    timer_routibe()
    if status is away
    if first_time_away then
    remember pms
    else
    for every pm that is not in remembered pms: respond and remember
    endif
    else
    remember status was not away
    endif

    So maybe it will be more than 10 lines of code, but less than 20.
    If you use GetPMWindows as I first proposed, there is no extra work to do to “remember” the answered pms, after you done the respond part, the entire list can be saved as pms that were responded to.

  45. Hi Chike, I am back after 2 hours. But stuck at the “Flow” Part…

    Ok I got the timer done almost, but I have problems at the first part you showed me (Flow).
    Lets say the code below is my AWAY COMMAND that I put below my away button.

    EDITED AGAIN……….
    Code Removed as I am not done yet,, Cant reveal the surprise… (Was waiting for Chikes Respond)

    And this is where I am stuck:

    if status is away:
    if wasn't away before: remember all openned PM

    Now where should I start with the FLOW? Should I start the flow below the away code.
    And could you help me with those 2 lines ? Thank you very much.. Now I get a bit of a sence to this.

  46. @String wrote:

    I’ll try to help here, but I’m not really sure where your at or what your question is exactly.
    @ChiNa-Man wrote:

    And this is where I am stuck:
    Code: Select all
    if status is away:
    if wasn’t away before: remember all openned PM

    If I understand correctly, It’s easy to know when you are Away since you change your status to Away via your own program.
    So, In your timer :
    If Away = True Then
    Code for logging open pm’s or “remembering” them.
    End If

    Hi String my Mate, Yeh I did try that way, and many other ways. I mean I got the timer right, but am stuck about how to create an IF statement for “Open Pm Windows”!

    And how to capture if a PM Window Opens or message is recieved?

    if "pm windows open" then
    send away message (Which is my RichTextBox.Text)
    end
    if "pm windows close" then do nothing
    end

    How to create an IF away of this:

    If "away" then activate My "RichTextBox" function (Send Message)
    End

    And where should i put this exact code below, If it should be under my away button or create another function.

    I may be the worse to explain, Hope you got me !

Leave a Reply

You must Register or Login to comment on How to get a reaction on a Recieved PM?