'Nuther(和最后?)挂钩问题。 [英] 'Nuther (and final?) Hooking question.
问题描述
我正在同步保存我的应用程序数据与插入我的com插件的插件的文件保存。我已成功挂钩文件,保存和Ctrl-S。我想介绍一个最终保存方案。
当应用程序的数据文件发生更改并且用户使用文件关闭或Red X,然后应用程序弹出一个MessageBox,其中包含熟悉的保存对文件名的更改?
我可以看到MessageBox弹出时使用下面的WH_CBT hookproc中的代码。
< pre lang =c ++> if (nCode == HCBT_ACTIVATE)
{
char WindowString [ 40 ];
GetWindowText((HWND)wParam,WindowString, 40 );
if (!strcmp(WindowString, 应用程序的名称))
{
HWND txtLabel = GetDlgItem((HWND)wParam,0xffff);
GetWindowText(txtLabel,WindowString, 16 );
if (!strcmp(WindowString, 将更改保存到))
// 快速保存我们的2k数据因为我们正在关闭...
}
}
}
现在,当用户单击是时,将发送带有ID的WM_NOTIFY,但我似乎可以捕获
到目前为止尝试的任何挂钩类型的消息。并且在Google上搜索,我发现自己处于MessageBox修改线程的海洋中。
是否可以按下Yes按钮?必须是如果Spy ++可以做到这一点。
谢谢
:Ron
< blockquote>当我插入的应用程序(作为第三方)保存我的数据时保存我的数据
作为我的数据,它的数据将保持同步。
该应用程序是一个商业编译的应用程序,而不是我的。我插入的插件规范中没有提供API。
:Ron
Hi,
I am syncing the saving of my application data with the file saving of the plug-in my com dll is plugged into. I have successfully hooked File,save and Ctrl-S. There is one final saving scenario that I would like to cover.
When the application''s data file is changed and the user closes the application with File Close or the Red X, then the application pops up a MessageBox with the familiar, "Save changes to filename?"
I can see when the MessageBox pops up using the code in a WH_CBT hookproc below.
if(nCode == HCBT_ACTIVATE)
{
char WindowString[40];
GetWindowText((HWND)wParam,WindowString,40);
if(!strcmp(WindowString,"The Application's Name"))
{
HWND txtLabel = GetDlgItem((HWND)wParam,0xffff);
GetWindowText(txtLabel,WindowString,16);
if(!strcmp(WindowString,"Save changes to"))
// Save our 2k of data quickly as we are closing...
}
}
}
Now when the user clicks Yes, a WM_NOTIFY is sent out with the ID but I can''s seem to trap
that message in any hook type tried thus far. And googling around, I find myself in a sea of MessageBox modification threads.
Is catching the Yes button push possible? Must be if Spy++ can do it.
Thanks
:Ron
Gotta save my data when the application I am plugged into (as a 3rd party) saves it''s
as my data and it''s data are to stay in sync.
The application is a commercial compiled one not mine and there is no API provided in the plug-in spec I an plugged into.
:Ron
这篇关于'Nuther(和最后?)挂钩问题。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!