开发者

Cant find a 3rd party QWidget with injected code & QWidget::find(hwnd)

开发者 https://www.devze.com 2023-02-02 05:28 出处:网络
I have a dll in a thi开发者_如何学Crd party address space, hooked using a cbt hook.However, when I try and do this:

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);
     }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号