views:

71

answers:

2

Hi, I am working on a C# XNA screensaver kit and so far, everything is in place except for the configuration dialog which must be modal to the Screen Saver Settings dialog provided by windows ("/c:<hwnd>" argument).

My benchmark is Vistas builtin 3D Text screensaver - my code shall provide the same features and regarding the configuration dialog, 3D Text displays fully modal to the Screen Saver Settings dialog and when clicking Screen Saver Settings dialog, the dialogs blink without accepting the click.

I have tried the method of wrapping the HWND with a IWin32Window as suggested by Ryan Farley, but even though my dialog displays on top of the Screen Saver Settings dialog, the controls in Screen Saver Settings dialog still can be clicked.

So do I need some exotic Win32API calls to inform the parent dialog that it has been modalized or does a more clean solution exist?

A: 

Try calling the SetParent API function.

SLaks
I am already using SetParent, but I have now discovered that the HWND provided by windows to the screensaver is a child of the settings dialog, so by calling GetParent on the HWND, I get a HWND that represents the dialog.
Christian Madsen
So, does it work?
SLaks
Yes it does. My configuration dialog is fully modal to the windows screensaver settings dialog.
Christian Madsen
A: 

Actually, it turned out that the HWND provided by windows to the screensaver is a child of the settings dialog, so by calling GetParent on the HWND, I get an HWND that represents the dialog.

Today is the day that I wrote my first question on stackoverflow.com and answered the first question.

Christian Madsen