Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2007.07.01;
Скачать: CL | DM;

Вниз

Handleи кнопка ToolButton   Найти похожие ветки 

 
Ламонов Олег   (2007-04-29 10:52) [0]

Уважаемые мастера.
Скажите, можно ли,имея, handle окна нажать на
кпопку ToolButton?
Использую процедуру, но она работает только на обчных кнопках.
Спасибо.

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("Окно не найдено !");
     2: H := hWnd(SL.Objects[1]);
     else
       ShowMessage("Текст определен !");
   end;
 finally
   SL.Free;
 end;
 Result := H <> 0;
 if Result then
 PostMessage(H, BM_CLICK, 0, 0);
end;


 
begin...end ©   (2007-04-29 11:07) [1]

У ToolButton"ов нет handle. Нажать такую кнопку можно, послав ToolBar"у, на котором она находится, сообщение TB_PRESSBUTTON.



Страницы: 1 вся ветка

Текущий архив: 2007.07.01;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.019 c
2-1181537141
Kolan
2007-06-11 08:45
2007.07.01
Как сделать чтобы форму из репозитория можно было делать главной?


15-1180538828
@!!ex_
2007-05-30 19:27
2007.07.01
Потестите редактор, плиз.


15-1180439563
DeadMeat
2007-05-29 15:52
2007.07.01
*.BPLки


15-1179599783
GeLLeR
2007-05-19 22:36
2007.07.01
STALKER


2-1181207740
alienff
2007-06-07 13:15
2007.07.01
FTP