如何发送单击另一个应用程序ToolBarWindow32对象内的按钮 [英] How to Send click a button within another application ToolBarWindow32 object

查看:72
本文介绍了如何发送单击另一个应用程序ToolBarWindow32对象内的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要发送另一个应用程序中的单击按钮
ToolBarWindow32对象.我已经在互联网上找到了,但仍然做不到.
我使用了SendMessage(hToolbar, TB_PRESSBUTTON, (WPARAM)0, MAKELONG(TRUE, 0));,但没有任何反应.我也尝试过

I need to send click a button within another application
ToolBarWindow32 object. I have found on internet but i can''t still do it.
I used SendMessage(hToolbar, TB_PRESSBUTTON, (WPARAM)0, MAKELONG(TRUE, 0)); but nothing happened. I also tried

TBBUTTON TB_Data;<br />
SendMessage(hToolbar, TB_GETBUTTON, (WPARAM)1 /*index*/, (LPARAM)&TB_Data);<br />
SendMessage(hToolbar, TB_PRESSBUTTON, TB_Data.idCommand, (LPARAM)true);<br />





or

SendMessage(hToolbar, TB_PRESSBUTTON, 0, 0);<br />


但他们并不担心.
--------------


but they aren''t worrking.
--------------

HWND hToolbar;
TBBUTTON TB_Data;

HWND hWnd = ::FindWindow(0, L"Test window");

hToolbar= ::FindWindowEx(hWnd, 0, L"ToolbarWindow32", 0);

// Send click...
// Help me



预先感谢.



Thanks in advance.

推荐答案

您已经尝试过了吗? :):
Have you already tried it ? :) :
::SendMessage(hWndFrameOfBar,
              WM_COMMAND,
              (WPARAM) iBtnCommand,
              (LPARAM) 0);


尝试依次发送以下2条命令-
Try sending the following 2 commands one after the other -
SendMessage(hToolbar, TB_PRESSBUTTON, TB_Data.idCommand, (LPARAM)TRUE);
SendMessage(hToolbar, TB_PRESSBUTTON, TB_Data.idCommand, (LPARAM)FALSE);


感谢_Superman_
但是他们不起作用...

Thank _Superman_
But They don''t work...

HWND hToolbar;
TBBUTTON TB_Data;

HWND hWnd = ::FindWindow(0, L"Test window");

hToolbar = ::FindWindowEx(hWnd, 0, L"ToolbarWindow32", 0);

::SendMessage(hToolbar, TB_GETBUTTON, (WPARAM)6 /*index*/, (LPARAM)&TB_Data);
// ==> TB_Data was not changed.
// "Test windows" was closed...?

::SendMessage(hToolbar, TB_PRESSBUTTON, TB_Data.idCommand, (LPARAM)TRUE);
::SendMessage(hToolbar, TB_PRESSBUTTON, TB_Data.idCommand, (LPARAM)FALSE);


这篇关于如何发送单击另一个应用程序ToolBarWindow32对象内的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆