Hi together,
I wrote a screen saver for windows using QT. Everything works fine, but not the preview.

From the commandline I get a parameter like "/p:345678". The number incidicate the WId of the parent window, the "mini monitor" in the windows build-in dialog for setting up the screensaver.

So I tried:

QWidget *parent=QWidget::find((HWND)WId);

Then for debugging purpose:
if (parent==NULL)
QMessageBox::information(NULL,"","No parent "+QString::number(WId));
else QMessageBox::information(NULL,"","Parent found "+QString::number(WId));

Then create the widget:
QWidget *miniMonitor=new QWidget(parent);

But it does not work. parent ist always NULL. Althought the WId is correct, I can't get a pointer to the parent window to create a child window.

In a windows API example they do something like:
if( strncmp( lpszCmdLine, "/p", 2 ) == 0 )
{
// preview screen
lpszCmdLine += 3;
HWND hParentWnd = (HWND)strtoul( lpszCmdLine, '\0', 10 );
GetClientRect( hParentWnd, &rc );

hwndMain = CreateWindow("MainWndClass", "myScreenSaver",
WS_CHILD, rc.left, rc.top, rc.right, rc.bottom, hParentWnd, NULL, hinst, NULL);
}

How to do this in QT?

Thanks for tips, Bernd