1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Donation with Paypal!!!

    Go to your paypal account and send directly donation to [email protected]

    1 month - 10 $ - Standart VIP

    6 months - 20 $- Standart VIP

    1 year - 30 $- Standart VIP

    2 years - 50 $- Standart VIP

    Gold member for life - 150 $- Standart VIP

    High Vip (Standart VIP include) group please send PM or email to [email protected] for info

    After Donation please send email to [email protected]

  3. Donation Ways 2020


    Paysend
  4. Telegram
Dismiss Notice

Donation with Paypal!!!

Go to your paypal account and send directly donation to [email protected]

1 month - 10 $ - Standart VIP

6 months - 20 $- Standart VIP

1 year - 30 $- Standart VIP

2 years - 50 $- Standart VIP

Gold member for life - 150 $- Standart VIP

High Vip (Standart VIP include) group please send PM or email to [email protected] for info

After Donation please send email to [email protected]

Dismiss Notice
For open hidden message no need write thanks, thank etc. Enough is click to like button on right side of thread.

SendMessage Another App

Discussion in 'Delphi Programming' started by AdminDF, Feb 14, 2014.

  1. AdminDF
    Online

    AdminDFAdminDF is a Verified Member Delphifan Staff Member DF Staff

    Code:
    function EnumChildProc(Wnd: hWnd; SL: TStrings): BOOL; stdcall;
    var
    szFull: array[0..MAX_PATH] of Char; //Buffer for window caption
    begin
    Result := Wnd <> 0;
    if Result thenĀ 
    begin
    GetWindowText(Wnd, szFull, SizeOf(szFull)); // put window text in buffer
    if (Pos(SL[0], StrPas(szFull)) > 0) // Test for text
    and (SL.IndexOfObject(TObject(Wnd)) < 0) // Test for duplicate handles
    then SL.AddObject(StrPas(szFull), TObject(Wnd)); // Add item to list
    EnumChildWindows(Wnd, @EnumChildProc, Longint(SL)); //Recurse into child windows
    end;
    end;
    
    function ClickButton(ParentWindow: Hwnd; ButtonCaption: string): Boolean;
    var
    SL: TStringList;
    H: hWnd;
    begin
    SL := TStringList.Create;
    try
    SL.AddObject(ButtonCaption, nil); // First item in list is text to find
    EnumChildWindows(ParentWindow, @EnumChildProc, Longint(SL));
    H := 0;
    case SL.Count of
    1: ShowMessage('Window text not found.');
    2: H := hWnd(SL.Objects[1]);
    elseĀ 
    ShowMessage('Ambiguous text detected.');
    end;
    finally
    SL.Free;
    end;
    Result := H <> 0;
    if Result then PostMessage(H, BM_CLICK, 0, 0);
    end;
     

Share This Page