本文介绍了如何发送单击另一个应用程序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.
推荐答案
::SendMessage(hWndFrameOfBar,
WM_COMMAND,
(WPARAM) iBtnCommand,
(LPARAM) 0);
SendMessage(hToolbar, TB_PRESSBUTTON, TB_Data.idCommand, (LPARAM)TRUE);
SendMessage(hToolbar, TB_PRESSBUTTON, TB_Data.idCommand, (LPARAM)FALSE);
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对象内的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!