Hi
Thanks for the quick replies. Actually I'm trying to make a DLL which receives a HWND and then paints a bitmap in the window. I thought I could do this in paintEvent() by providing my DLL function with the window's HWND. Can't this work with QWidget?
Btw, yes, it's been three years since I last used Qt. Trolltech changed their license model so it suddenly became interesting to try out in my new company.
I've also tried the following which also doesn't work (and probably for the same reason):
{
HWND hWnd = winId();
HDC hdc;
hdc = ::GetDC(hWnd);
RECT r;
r.left = this->rect().left()+50;
r.top = this->rect().top()+50;
r.right = this->rect().right();
r.bottom = this->rect().bottom();
int xx = ::DrawText(hdc, L"FOOOOOOOOOO", 5, &r, DT_VCENTER | DT_CENTER | DT_SINGLELINE);
ReleaseDC(hWnd, hdc);
}
void MyWidget::paintEvent(QPaintEvent *p)
{
HWND hWnd = winId();
HDC hdc;
hdc = ::GetDC(hWnd);
RECT r;
r.left = this->rect().left()+50;
r.top = this->rect().top()+50;
r.right = this->rect().right();
r.bottom = this->rect().bottom();
int xx = ::DrawText(hdc, L"FOOOOOOOOOO", 5, &r, DT_VCENTER | DT_CENTER | DT_SINGLELINE);
ReleaseDC(hWnd, hdc);
}
To copy to clipboard, switch view to plain text mode
-- Bjoern
Bookmarks