[Delphi]call to all delphi dev.

This topic contains 5 replies, has 4 voices, and was last updated by  Departure 2 months, 3 weeks ago.

  • Author
    Posts
    1 Star2 Stars3 Stars4 Stars5 Stars Rating: 5.00 - 1 votes
  • #15346
    Member
    Posts: 37

    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 🙄

    #38868
    Administrator
    Posts: 1093

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

    #38866
    Member
    Posts: 37

    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;

     

    #38867
    Administrator
    Posts: 1011

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

    #65764
    Anonymous
    Member
    Posts: 34

    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

    #65814
    Administrator
    Posts: 1011

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

You must be logged in to reply to this topic.