I have a dll in a thi开发者_如何学Crd party address space, hooked using a cbt hook. However, when I try and do this:
HWND hwnd = FindWindow(wct_target_wnd);
QWidget* widget = QWidget::find(hwnd);
if(widget != 0)
{
MessageBox(NULL, L"worked\n",NULL, NULL);
}
I know the widget is there, the hwnd is correct, I just can't seem to get a pointer to it.
According to everything that I have read this should work but it always return zero, can anybody suggest why?
c++ visual-studio-2008
Thanks.
What about using QApplication, getting a list of all the widgets then checking their respective window ids?
Something like
foreach (QWidget *widget, QApplication::allWidgets())
{
if(widget->winId() == hwnd)
{
MessageBox(NULL, L"worked\n",NULL, NULL);
}
}
精彩评论