[Delphi]call to all delphi dev.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #191038
    Jiiix
    Member

    Hello,

    guys can you help me please on this 🙁

    i wanna pass the room text to my form on delph

    procedure TForm1.Button1Click(Sender: TObject);
    var
    hWnd1,hWnd2,parent, child, alt,iHnd :long;
    TextBuffer: string;
    TextLength: Integer;
    begin
    //hWnd1 := FindWindow(pchar('#32770'), nil);;
    parent := FindWindow('DlgGroupChat Window Class', nil);;
    
    if parent = 0 then
    showmessage('1'); //for test purposes
    
    child := FindWindowEx(parent,0,'SplitterWindowEx',nil);
    //hWnd2 := FindWindowEx(hWnd1,0,'RichEdit20W',nil);
    if child = 0 then
    showmessage('2'); //for test purposes
    
    child := FindWindowEx(child,0,'SplitterWindowEx',nil);
    //hWnd2 := FindWindowEx(hWnd1,0,'RichEdit20W',nil);
    if child = 0 then
    showmessage('3'); //for test purposes
    
    child := FindWindowEx(child,0,'SplitterWindowEx',nil);
    //hWnd2 := FindWindowEx(hWnd1,0,'RichEdit20W',nil);
    if child = 0 then
    showmessage('4'); //for test purposes
    
    child := FindWindowEx(child,0,'SplitterWindowEx',nil);
    //hWnd2 := FindWindowEx(hWnd1,0,'RichEdit20W',nil);
    if child = 0 then
    showmessage('5'); //for test purposes
    
    alt := GetWindow(child, GW_Child);
    if alt = 0 then
    showmessage('6'); //for test purposes
    
    alt := GetWindow(alt, GW_HWNDNEXT);
    if alt = 0 then
    showmessage('7'); //for test purposes
    
    alt := FindWindowEx(alt,0,'atlaxwin90',nil);
    //hWnd2 := FindWindowEx(hWnd1,0,'RichEdit20W',nil);
    if alt = 0 then
    showmessage('8'); //for test purposes
    
    alt := FindWindowEx(alt,0,'#32770',nil);
    //hWnd2 := FindWindowEx(hWnd1,0,'RichEdit20W',nil);
    if alt = 0 then
    showmessage('9'); //for test purposes
    
    iHnd := FindWindowEx(alt,0,'richedit20w',nil);
    //hWnd2 := FindWindowEx(hWnd1,0,'RichEdit20W',nil);
    if iHnd = 0 then
    showmessage('10'); //for test purposes
    
    TextLength := SendMessage(iHnd, LB_GETTEXTLEN, 0, 0);;
    SetLength(TextBuffer, TextLength);
    
    SendMessage(iHnd, EM_SETSEL, 0, TextLength);
    SendMessage(iHnd, WM_CUT, 0, 0);
    SendMessage(iHnd, LB_GETTEXT, 0, LPARAM(PChar(TextBuffer)));
    RichEdit1.Lines.Add(iHnd);
    end;`i

    Whats is problem please 🙄

    #191043
    Chike
    Member

    Problen is you are using old methids no one even will care too look what the problem is.
    See this example

    #191042
    Jiiix
    Member

    I will already see it but it seems complicated 😕

    anyway i finally extract the RichEdit20W with this code below

    i just wanna know how to covert the hWnd1 to memo1.lines please

     

    procedure TForm1.Button1Click(Sender: TObject);
    var
    hWnd1 :long;
    CheckMsg :String;
    begin
    CheckMsg := '1'; //convert it to 0 to you can check the FindWindowEx
    
    hWnd1 := FindWindow('DlgGroupChat Window Class', nil);;
    if (hWnd1 = 0) and (CheckMsg = '0') then //for test purposes
    showmessage('1');
    
    hWnd1 := FindWindowEx(hWnd1,0,'SplitterWindowEx',nil);
    if (hWnd1 = 0) and (CheckMsg = '0') then //for test purposes
    showmessage('2');
    
    hWnd1 := FindWindowEx(hWnd1,0,'SplitterWindowEx',nil);
    if (hWnd1 = 0) and (CheckMsg = '0') then //for test purposes
    showmessage('3');
    
    hWnd1 := FindWindowEx(hWnd1,0,'SplitterWindowEx',nil);
    if (hWnd1 = 0) and (CheckMsg = '0') then //for test purposes
    showmessage('4');
    
    hWnd1 := FindWindowEx(hWnd1,0,'SplitterWindowEx',nil);
    if (hWnd1 = 0) and (CheckMsg = '0') then //for test purposes
    showmessage('5');
    
    hWnd1 := FindWindowEx(hWnd1,0,'SplitterWindowEx',nil);
    if (hWnd1 = 0) and (CheckMsg = '0') then //for test purposes
    showmessage('6');
    
    hWnd1 := FindWindowEx(hWnd1,0,'ClassCPaneContainerEx',nil);
    if (hWnd1 = 0) and (CheckMsg = '0') then //for test purposes
    showmessage('7');
    
    hWnd1 := FindWindowEx(hWnd1,0,'ATL:00AD6100',nil);
    if (hWnd1 = 0) and (CheckMsg = '0') then //for test purposes
    showmessage('8');
    
    hWnd1 := FindWindowEx(hWnd1,0,'ATL:00AD65E0',nil);
    if (hWnd1 = 0) and (CheckMsg = '0') then //for test purposes
    showmessage('9');
    
    hWnd1 := FindWindowEx(hWnd1,0,'AtlAxWin90',nil);
    if (hWnd1 = 0) and (CheckMsg = '0') then //for test purposes
    showmessage('10');
    
    hWnd1 := FindWindowEx(hWnd1,0,'#32770',nil);
    if (hWnd1 = 0) and (CheckMsg = '0') then //for test purposes
    showmessage('11');
    
    hWnd1 := FindWindowEx(hWnd1,0,'RichEdit20W',nil);
    if (hWnd1 = 0) and (CheckMsg = '0') then //for test purposes
    showmessage('12');
    
    Memo1.Lines.Add('Room TEXT = +String(hWnd1)'); // <<<<< this just a example
    
    end;

     

    #191041
    Departure
    Member

    As chike said, you are using an outdated method, there is much more simpler way to achieve what you want.

    #191040
    Admin
    Administrator

    so why not tell him what he needs to get the best method so he can learn. helping people to learn is the best way and the way we can all learn. Im new at this and it would teach me somethings as well.

     

    We all look for being put in the right direction on things we don’t know so we can learn in our own way with out someone doing it for me orthe person asking the question. starting at any point even if it’s a lod method is better then not starting at all.

     

    good luck jiix and i look forward to see if you get put in the right direction

    #191039
    Departure
    Member

    The methods are posted all over this forum.. I am pretty sure he has worked this out by now

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