- This topic has 17 replies, 4 voices, and was last updated 10 years ago by Admin.
-
AuthorPosts
-
November 15, 2014 at 11:43 pm #186471AdminAdministrator
He so Paltalk 11.5 update no longer has the “Room” on the paltalk rooms title. so the program in VB6 are not able to connect that way using this code.
Public Function FindPalRooms(ByVal lhWnd As Long, ByVal lParam As Long) As Long Dim retVal As Long, ProcessID As Long, ThreadID As Long Dim WinClassBuf As String * 255, WinTitleBuf As String * 255 Dim WinClass As String, WinTitle As String retVal = GetClassName(lhWnd, WinClassBuf, 255) WinClass = StripNulls(WinClassBuf) ' remove extra Nulls & spaces retVal = GetWindowText(lhWnd, WinTitleBuf, 255) WinTitle = StripNulls(WinTitleBuf) 'Added so text is sent only to chat room and not to pm If LCase(WinClass) = LCase(mTargetWinClass) Then If InStr(1, WinTitle, " Room", vbTextCompare) <> 0 Then Form1.Combo1.AddItem (WinTitle) End If End If FindPalRooms = True End Function
So we need to find another way, it prob easy but if anyone has a easy solution post it here Thanks 🙂
November 16, 2014 at 2:49 am #186488AdminAdministratorK I am able to get then using something I was using to get the windows title for PMs like this. Still using the combobox.
Function
Private Function GetText(Get_hWnd As Long) As String Dim lenTxt As Long, retText As String lenTxt = GetWindowTextLength(Get_hWnd) + 1 retText = String$(lenTxt, " ") GetWindowText Get_hWnd, retText, lenTxt GetText = retText End Function
Call it with
Combo1.Clear Combo1.AddItem GetText(FindWindow("dlggroupchat window class", vbNullString)) Combo1.ListIndex = 0
It work’s but the shit gets what ever is focus PM or Room 🙂
November 16, 2014 at 7:12 am #186487ChikeMemberUser list is invisible in IM window, check this code.
Imports System.Text Module Module4 Public Declare Auto Function FindWindow Lib "User32.dll" _ (ByVal lpszClass As String, ByVal lpszWindow As String) As IntPtr Public Declare Auto Function GetWindowThreadProcessId Lib "User32.dll" _ (ByVal hWnd As IntPtr, Optional ByRef lpdwProcessId As ULong = Nothing) As Integer Public Delegate Function WNDENUMPROC(ByVal hwnd As IntPtr, ByVal lParam As Object) As Boolean Public Declare Auto Function EnumThreadWindows Lib "user32.dll" _ (ByVal dwThreadId As Integer, ByVal lpfn As WNDENUMPROC, ByRef lParam As Object) As Boolean Public Delegate Function EnumChildindowsProc(ByVal Handle As IntPtr, ByVal lParam As Object) As Boolean Public Declare Auto Function EnumChildWindows Lib "User32.dll" _ (ByVal hwnd As IntPtr, ByVal Callback As EnumChildindowsProc, ByVal lParam As Object) As Boolean Public Declare Auto Function GetClassName Lib "User32.dll" _ (hWnd As IntPtr, lpClassName As StringBuilder, ByVal nMaxCount As UInteger) As Integer Public Declare Auto Function GetDlgCtrlID Lib "User32.dll" _ (ByVal hwnd As IntPtr) As Integer Public Declare Auto Function IsWindowVisible Lib "User32.dll" _ (hwnd As IntPtr) As Boolean Declare Auto Function GetWindowText Lib "User32.dll" _ (hWnd As IntPtr, lpString As StringBuilder, ByVal nMaxCount As Integer) As Integer Enum ChatType IM Room End Enum Class ChatWindow Sub New() type = ChatType.IM hwndText = 0 hwndInput = 0 hwndUsers = 0 End Sub Public type As ChatType Public title As String Public hwndText As Long Public hwndInput As Long Public hwndUsers As Long End Class Function EnumChatChildindows(ByVal hwnd As IntPtr, ByVal lParam As ChatWindow) As Boolean Dim ctlID = GetDlgCtrlID(hwnd) Select Case ctlID Case &H6FD If IsWindowVisible(hwnd) Then lParam.hwndUsers = hwnd lParam.type = ChatType.Room End If Case &HCA lParam.hwndText = hwnd Case &HCB lParam.hwndInput = hwnd End Select Return True End Function Function EnumChatWindows(ByVal hwnd As IntPtr, ByVal lParam As ArrayList) As Boolean Dim sb As New StringBuilder(128) If GetClassName(hwnd, sb, sb.Capacity) = 0 Then Return True If sb.ToString() = "DlgGroupChat Window Class" Then Dim window As ChatWindow = New ChatWindow EnumChildWindows(hwnd, AddressOf EnumChatChildindows, window) If window.hwndInput <> 0 Then GetWindowText(hwnd, sb, sb.Capacity) window.title = sb.ToString() lParam.Add(window) End If End If Return True End Function Sub main() Dim hwnd = FindWindow("SEINFELD_SUPERMAN", vbNullString) Dim dwThreadID As ULong = GetWindowThreadProcessId(hwnd) Dim myWindows = New ArrayList EnumThreadWindows(dwThreadID, AddressOf EnumChatWindows, myWindows) End Sub End Module
A simplified vers. to just check if the window is a chatroom
Class bool Sub New() isTrue = False End Sub Public isTrue As Boolean End Class Function EnumChatChildindows(ByVal hwnd As IntPtr, ByVal lParam As bool) As Boolean If GetDlgCtrlID(hwnd) = &H6FD Then lParam.isTrue = IsWindowVisible(hwnd) Return False End If Return True End Function Public Function IsChatWindow(hwnd As IntPtr) As Boolean Dim isChat As New bool EnumChildWindows(hwnd, AddressOf EnumChatChildindows, isChat) Return isChat.isTrue End Function
November 16, 2014 at 9:08 am #186486DepartureMemberNice chike, I use something similar in Delphi, but I can benefit from the snippet you posted to adjust what I am currently using…
thanks
November 16, 2014 at 7:04 pm #186485ChikeMemberIt’s the same method we use to find controlls only changed a bit to identify chat room.
Using the 1st code before oppening the room selector you can already have the controlls.
November 17, 2014 at 8:05 pm #186484AdminAdministratorHey chike, but that’s for VB .Net right? cause I need it for VB 6.0
November 17, 2014 at 8:13 pm #186483ChikeMemberHey chike, but that’s for VB .Net right? cause I need it for VB 6.0
LOL convert
What do you still have in VB 6?
November 17, 2014 at 8:31 pm #186482AdminAdministratorOkay what if I change ” Room” to Just “” FindPalRooms Function
and it will look like thisPublic Function FindPalRooms(ByVal lhWnd As Long, ByVal lParam As Long) As Long Dim retVal As Long, ProcessID As Long, ThreadID As Long Dim WinClassBuf As String * 255, WinTitleBuf As String * 255 Dim WinClass As String, WinTitle As String retVal = GetClassName(lhWnd, WinClassBuf, 255) WinClass = StripNulls(WinClassBuf) ' remove extra Nulls & spaces retVal = GetWindowText(lhWnd, WinTitleBuf, 255) WinTitle = StripNulls(WinTitleBuf) 'Added so text is sent only to chat room and not to pm If LCase(WinClass) = LCase(mTargetWinClass) Then If InStr(1, WinTitle, "", vbTextCompare) <> 0 Then Form1.Combo1.AddItem (WinTitle) End If End If FindPalRooms = True End Function
It works but will it have any implications, besides connecting to either the room or PM?
November 17, 2014 at 8:33 pm #186481AdminAdministratorLol Chike is for the old programs some people still use them 🙂 But I do use VB .Net now
November 17, 2014 at 9:50 pm #186480ChikeMemberDo you have enumchild windows in any of those programs? You must have to find the controls for 11.3 or 11.4
November 18, 2014 at 3:55 am #186479ChikeMemberSomething like this, haven’t even try to compile it.
Declare Function EnumChildWindows Lib "User32.dll" _ (ByVal hwnd As Integer, ByVal Callback As Integer, ByRef lParam As Any) As Integer Declare Function IsWindowVisible Lib "User32.dll" _ (ByVal hwnd As Integer) As Integer Declare Function GetDlgCtrlID(ByVal hwnd as Integer) As Integer Function EnumChatChildindows(ByVal hwnd As Integer, ByRef lParam As Boolean) As Integer If GetDlgCtrlID(hwnd) = &H6FD Then lParam = IsWindowVisible(hwnd) <> 0 EnumChatChildindows = 0 End If EnumChatChildindows = 1 End Function Function IsChatWindow(hwnd As Integer) As Boolean Dim isChat As Boolean isChat = False EnumChildWindows(hwnd, AddressOf EnumChatChildindows, isChat) IsChatWindow = isChat End Function
November 19, 2014 at 4:07 am #186478AdminAdministratorThanks man 🙂 I gonna check it. I let you know
November 19, 2014 at 4:41 am #186477ChikeMemberChange the end if to else.
November 19, 2014 at 6:11 am #186476AhFoxMemberIt looks like Paltalk made changes again !! I hope my stuffs still work, ’cause my old computer just crashed I might not have the old library code anymore. Unless I have to reverse engineer.
November 20, 2014 at 10:32 am #186475DepartureMemberIt’s the same method we use to find controlls only changed a bit to identify chat room. Using the 1st code before oppening the room selector you can already have the controlls.
yeah I see that, but logic dictates that if there is no Roomlist(dlgId) then its a pm window else it must be a room.
btw I found a nice little delphi sample on streaming RTF text to other applications, it not too far off what we use now but there is some intersting flags and callbacks
It is in Delphi but im sure you will no problems understanding it..
implementation uses CommonMemoryUnit; {$R *.DFM} type PSetTextEx = ^TSetTextEx; tagSetTextEx = record flags : DWORD; codepage : UINT; end; TSetTextEx = tagSetTextEx; SETTEXTEX = tagSetTextEx; const EM_SETTEXTEX = WM_USER + 97; ST_DEFAULT = 0; ST_KEEPUNDO = 1; ST_SELECTION = 2; ST_NEWCHARS = 4; ST_UNICODE = 3; var FStreamRec : TEditStream; FStream : TStringStream; //-------------------------------------------------- --------------------------- // EM_STREAMOUT message for callback function //-------------------------------------------------- --------------------------- function EditStreamCallBack(dwCookie: Longint; pbBuff: PByte; cb: Longint; var pcb: Longint): Longint; stdcall; begin try pcb := FStream.Write(pbBuff^, cb); Result:= 0; except Result:= 1; end; end; //================================================== =========================== // Display in TRichEdit reads the rich text file //================================================== =========================== procedure TForm1.Button1Click(Sender: TObject); var AFilePath : String; begin OpenDialog1.Filter := 'RTFファイル|*.RTF'; if InitDir = '' then begin OpenDialog1.InitialDir := ExtractFileDir(Application.ExeName); end; if OpenDialog1.Execute then begin AFilePath := OpenDialog1.FileName; RichEdit1.Lines.LoadFromFile(AFilePath); end; end; //================================================== =========================== // Transfer the rich text without using the clipboard to other TRichEdit // // Use EM_SETTEXTEX message // Since there is no definition in Delphi XE, defined and used with the required structure // // The use of shared memory class CommonMemoryUnit of Halbow museum //================================================== =========================== procedure TForm1.Button2Click(Sender: TObject); var Flags : Integer; hTargetApp : HWND; hRich : HWND; SetTextRec : TSetTextEx; CM : TCommMemNT; CMRec : TCommMemNT; StrSize : Cardinal; StrText : AnsiString; begin //Get on the receiving side of the app handle hTargetApp := FindWindow(nil, 'TargetForm'); if hTargetApp = 0 then exit; //Get on the receiving side of the RichEdit handle hRich := FindWindowEx(hTargetApp, 0, 'TRichEdit', nil); if hRich = 0 then exit; //Set the flag to be used in EM_STREAMOUT Create a TStringStream FStream := TStringStream.Create(''); if RichEdit1.SelLength = 0 then begin Flags := SF_RTF or SFF_PLAINRTF; end else begin Flags := SF_RTF or SFF_PLAINRTF or SFF_SELECTION; end; //By specifying processing a callback function to be used in EM_STREAMOUT //When you return or callback function, rich text is stored in FStream FStreamRec.pfnCallback := @EditStreamCallBack; RichEdit1.Perform(EM_STREAMOUT, Flags, Longint(@FStreamRec)); //Convert the data of the stream in the string to an AnsiString //Argument of EM_SETTEXTEX must be AnsiString StrText := AnsiString(FStream.DataString); StrSize := Length(StrText); //To generate a shared memory class CM := TCommMemNT.Create(hTargetApp, StrSize); CMRec := TCommMemNT.Create(hTargetApp, 100); try //Stores transfer data to the shared memory CM.Write(0, Pointer(StrText), StrSize); //Set the transfer flag //flags Paste operation varies depending on the value of the receiving side (overwrite Toka Toka inserted) SetTextRec.flags := ST_DEFAULT; SetTextRec.codepage := CP_ACP; CMRec.Write(0, @SetTextRec, SizeOf(SetTextRec)); //Run transfer message SendMessage(hRich, EM_SETTEXTEX, WPARAM(CMRec.MemPtr), LPARAM(CM.MemPtr)); finally CM.Free; CMRec.Free; FStream.Free; end; end; end.
the only I need to check out for the shared memory part is the reference to “CommonMemoryUnit” its not a default unit in delphi
-
AuthorPosts
Related
- You must be logged in to reply to this topic.