- This topic has 15 replies, 6 voices, and was last updated 16 years ago by Chike.
-
AuthorPosts
-
April 14, 2008 at 6:25 pm #187572AdminAdministrator
Aigh so instead of doing all the new coding dealing with indexes and stuff, I went back to the old days ehheh 🙂 comvining, auto, chik, dep codes i cam up with this, now my main conce is will this work with green nicks as well as blacks, people are not givign me feedback so I need to know before I keep udating 8)
Dim iHnd As Long
Dim parent, child, alt, rich20 As Long
Dim res&, sel&, start_pos&, end_pos&, txt_len&
'iHnd = getPalSubForm(Form1.WindowClass, Form1.Combo1.Text, Form1.RoomOutboundTextBoxClass, Form1.SendTxtIndex)
On Error Resume Next
'disable editing, may not be needed
Call EnableWindow(iHnd, 0)
'Copy Text that has been typed in if any
parent = FindWindow("DlgGroupChat Window Class", Form1.Combo1.Text)
child = FindWindowEx(parent, 0, "WTL_SplitterWindow", vbNullString)
child = FindWindowEx(child, 0, "WTL_SplitterWindow", vbNullString)
child = FindWindowEx(child, 0, "WTL_SplitterWindow", vbNullString)
child = FindWindowEx(child, 0, "WTL_SplitterWindow", vbNullString)
alt = GetWindow(child, GW_Child)
alt = GetWindow(alt, GW_HWNDNEXT)
alt = FindWindowEx(alt, 0, "atlaxwin71", vbNullString)
alt = FindWindowEx(alt, 0, "#32770", vbNullString)
iHnd = FindWindowEx(alt, 0, "RichEdit20A", vbNullString)
iHnd = FindWindowEx(alt, iHnd, "RichEdit20A", vbNullString)
txt_len& = SendMessage(iHnd, WM_GETTEXTLENGTH, 0, 0)
If txt_len& > 0 Then ' don't need all this if user not typing
' save user selection / cursor position
Call SendMessage(iHnd, EM_GETSEL, ByVal VarPtr(start_pos&), ByVal VarPtr(end_pos&))
' select all text and cut
res = SendMessage(iHnd, EM_SETSEL, 0, ByVal txt_len&)
res = SendMessage(iHnd, WM_CUT, 0, 0)
End If
parent = FindWindow("DlgGroupChat Window Class", Form1.Combo1.Text)
child = FindWindowEx(parent, 0, "WTL_SplitterWindow", vbNullString)
child = FindWindowEx(child, 0, "WTL_SplitterWindow", vbNullString)
child = FindWindowEx(child, 0, "WTL_SplitterWindow", vbNullString)
child = FindWindowEx(child, 0, "WTL_SplitterWindow", vbNullString)
alt = GetWindow(child, GW_Child)
alt = GetWindow(alt, GW_HWNDNEXT)
alt = FindWindowEx(alt, 0, "atlaxwin71", vbNullString)
alt = FindWindowEx(alt, 0, "#32770", vbNullString)
iHnd = FindWindowEx(alt, 0, "RichEdit20A", vbNullString)
iHnd = FindWindowEx(alt, iHnd, "RichEdit20A", vbNullString)
Call SendMessageSTRING(iHnd, WM_SETTEXT, 0&, Text$)
Call SendMessageLong(iHnd, WM_KEYDOWN, 13, 0&)
'Send any typing back to box
If txt_len& > 0 Then
' text box is empty, paste saved text
res& = SendMessage(iHnd, WM_PASTE, 0, 0)
' restore selection / cursor position
res& = SendMessage(iHnd, EM_SETSEL, start_pos&, ByVal end_pos&)
End If
'enable editing
Call EnableWindow(iHnd, 1)April 14, 2008 at 7:20 pm #187587ChikeMemberBut why search the richedit20 twice?
April 14, 2008 at 7:33 pm #187586AdminAdministratorAh, that part umm well I the first search it to find out if anything is written on the text box, so it can be save 🙂 so the bots would not interrupt what a person is typing, and the other one is the regular send text.
April 14, 2008 at 8:59 pm #187585ChikeMemberLOL it’s the same control.
Wait something’s not eight there.
Call EnableWindow(iHnd, 0) should come after 1st search, and you can delete the second search.
And you can put both EnableWindow calls inside the ifs, the 1st right after the if and the second before end if, and get rid of rich20 res and sel.
Dim iHnd As Long
Dim parent, child, alt, As Long
Dim start_pos&, end_pos&, txt_len&
'iHnd = getPalSubForm(Form1.WindowClass, Form1.Combo1.Text, Form1.RoomOutboundTextBoxClass, Form1.SendTxtIndex)
On Error Resume Next
parent = FindWindow("DlgGroupChat Window Class", Form1.Combo1.Text)
child = FindWindowEx(parent, 0, "WTL_SplitterWindow", vbNullString)
child = FindWindowEx(child, 0, "WTL_SplitterWindow", vbNullString)
child = FindWindowEx(child, 0, "WTL_SplitterWindow", vbNullString)
child = FindWindowEx(child, 0, "WTL_SplitterWindow", vbNullString)
alt = GetWindow(child, GW_Child)
alt = GetWindow(alt, GW_HWNDNEXT)
alt = FindWindowEx(alt, 0, "atlaxwin71", vbNullString)
alt = FindWindowEx(alt, 0, "#32770", vbNullString)
iHnd = FindWindowEx(alt, 0, "RichEdit20A", vbNullString)
iHnd = FindWindowEx(alt, iHnd, "RichEdit20A", vbNullString)
txt_len& = SendMessage(iHnd, WM_GETTEXTLENGTH, 0, 0)
'Copy Text that has been typed in if any
If txt_len& > 0 Then ' don't need all this if user not typing
'disable editing, may not be needed
Call EnableWindow(iHnd, 0)
' save user selection / cursor position
Call SendMessage(iHnd, EM_GETSEL, ByVal VarPtr(start_pos&), ByVal VarPtr(end_pos&))
' select all text and cut
Call SendMessage(iHnd, EM_SETSEL, 0, ByVal txt_len&)
Call SendMessage(iHnd, WM_CUT, 0, 0)
End If
Call SendMessageSTRING(iHnd, WM_SETTEXT, 0&, Text$)
Call SendMessageLong(iHnd, WM_KEYDOWN, 13, 0&)
'Send any typing back to box
If txt_len& > 0 Then
' text box is empty, paste saved text
Call SendMessage(iHnd, WM_PASTE, 0, 0)
' restore selection / cursor position
Call SendMessage(iHnd, EM_SETSEL, start_pos&, ByVal end_pos&)
'enable editing
Call EnableWindow(iHnd, 1)
End If
April 14, 2008 at 9:25 pm #187584StringMember@Admin wrote:
now my main conce is will this work with green nicks as well as blacks, people are not givign me feedback so I need to know before I keep udating
If you use the method that autopilot posted Here, ie your FunText project, this will work with all colors in 9.x and all colors in 9.4. No need for index change or etc. Your good to go as long as that is the method you are using. Ive tested it in blacl/blue/green. Personally, I think using the code you posted above is a step backwards.
April 14, 2008 at 9:55 pm #187583autopilotMember@String wrote:
Personally, I think using the code you posted above is a step backwards.
It may be a step backwards, but if he does not understand what/how my example is doing, he does not know how to implement it.
Loco needs to take some time and learn VB2008 now that he has it. and yes my tutorial will work for 2008 the same as 2005.
April 14, 2008 at 11:54 pm #187582AdminAdministratorThanks chike 🙂
Wait, so auto code doesnt need the index shit, lol crap that’s what I thought aigh I gonna check it again, to see whats up,
ya talking bout this one right.
April 14, 2008 at 11:59 pm #187581AdminAdministratorI mean I wont need the readpalversion subs?
Crap I just gonna test it 😆April 15, 2008 at 12:35 am #187580AdminAdministratorlol okie this what trully confusing me if autos new codes doesnt need the index how come when I remove this line
Const SendTxtIndex9 As Integer = 3 ' All Pal Versions
It doesn’t send the text
I kindna understand this parts
Private Function SendTextHnd() As Long
Dim iPHnd As Long
iPHnd = getPalSubForm(WindowClass, Combo1.Text, "WTL_SplitterWindow", 4)
SendTextHnd = ChatHnd(iPHnd, SendTxtIndex)
End Function
Private Function ReadTextHnd() As Long
Dim iPHnd As Long
iPHnd = getPalSubForm(WindowClass, Combo1.Text, "WTL_SplitterWindow", 4)
ReadTextHnd = ChatHnd(iPHnd, ChaTxtIndex)
End FunctionIf I am not mestaking this are the handles for the bar where the smilies and text options are right, and that we we get the text index right after that 🙄
I got a god damn headache 😐
April 15, 2008 at 2:04 am #187579autopilotMembermy method stil uses index numbers, but i am starting from a different point! First I found the handle to the control that contains the two richtext controls. Then i use that as a new start point to find the correct richtext control. so the index values are the same for any color nic… but you can not use the autoit3 spy program to get the index values.
But again, this is only one way to do this. You can also chech some other control features as chike has pointed out.
April 15, 2008 at 2:06 am #187578DepartureMemberAdmin, im going to suggest a couple of things,
1. Looking at the Paltalk FunText any Pal92.zip code it seems you have to many fuctions proforming the same thing, I thinks its because you still have code from your old method using vb6, So I suggest you remove unwanted code and .bas’s that you dont use
2. I think autopilot should do a video tutorial to show how exactly he got these ” inedex’s” and show on his API spy the control order, then step by step show how to use emnuchildproc by making a send and recive text example
3. I have a feeling auto pilot could also make his code smaller because it seems alot for such a simple task to call emnuchildproc, Saying that the custom function he made was looking very good…
4. The best thing you could do is re-write your code, This im sure will gain smaller and faster code by doing this as you will also learn what each function does and how it works, you could stilll use current code as refference.
thats just some idea you might want to consider, even tho the way you send text to paltalk there is nothing wrong with that at all , and it works fine (no speed lost) the idea here is minimize the amount of coding as much as possiable and to make functions that are reusable
April 15, 2008 at 2:18 am #187577AdminAdministratorDep, I just forgat to clean it up, there a lot of stuff i gonna take off for the final versio.
And this the deal I want to update all the programs for paltalk 9.4 so I can concentrade on vs 2008 🙂
auto I kindna though it was something like that now I got it Thanks, I gonna use this method again Thanks a lot
April 17, 2008 at 11:46 pm #187576IMAFriendMemberAre we talking about getting the handles to the chat windows n stuff?
This is what I did. I haven’t tested with varioud colored nicks so I don’t know.
A) What do I want handles for?
-RoomText
-InputTextBox
-SendButton
-ListViewI made an object called ptRoom, which has 4 members, listed above.
Imagine each letter is a handle down the line. some are the wtl splitter, some are the atl stuff, etc.
So, it’s like a tree. I mapped it out.
-RoomText goes A.B.C.D.E.H.J.L
-InputTBox is A.B.C.D.E.F
-SendButton is A.B.C.D.E.G
-ListView is A.B.C.D.E.H.MI made one subroutine that went A.B.C.D.E (all 4 items go that far), and made this my ‘base’ handle.
Then I branched out to F and assigned that handle to my ptRoom.InputTBox
Then I branchced out from Base to G and assigned that to my ptRoom.SendButton
Then I branched out from base to H (new base)
From the new base, I got the J and L, for my RoomText and M for the ListView.Basically, I made one subroutine that follows the ‘tree’, sets a base where they start branching, and assigned all 4 items at one time.
That gives me a room object (ptRoom) with all 4 handles that I need, and I don’t have to look for the handles more than one time per room.
When the user clicks on the room or the room is opened or however you want to implement it, it finds your four handles and yer done.
Hopefully that makes sense. It might have to be modified for different colors or checking on that. And my description might be slighly off for how many branches, but the concept is there, and this probably will produce pretty efficient code.
G’luck.
April 18, 2008 at 2:13 pm #187575AdminAdministratorI think I get it, you like made a tree like one control following the next, but I think that’s the same as indexing and paltalk now is changing it in evey build I think 🙄
April 18, 2008 at 2:58 pm #187574ChikeMember@Admin wrote:
but I think that’s the same as indexing and paltalk now is changing it in evey build I think
Not exactly the same as indexing.
Instead just an index you have array of classes you look for, you can still do it with EnumChildWindows.
For every class you find you move to search the next, untill you found the last one.
For the edit text you need to look for the atlaxwin71 and then richedittext20a twice. The difference from index is that you have more knowledge about the tree hirarchy rather than just an index for specific class.
This code will probably work for all pal 9 versions and maybe 8 too. -
AuthorPosts
Related
- You must be logged in to reply to this topic.