tags:

views:

95

answers:

1

Hi,

I have a parent form, with some child windows (not forms - just windows, for example label controls) inside it. Under certain circumstances, I want one of those child windows to be drawn "above" the others, to display a message over the entire main form.

I've tried setting HWND_TOPMOST and HWND_TOP on the child windows, but it doesn't seem to have any effect at all. Am I doing something wrong, or do HWND_TOPMOST and HWND_TOP only work on forms, as opposed to controls within forms?

Thanks.

+1  A: 

HWND_TOPMOST only applies to top level windows, not child windows.

Use SetWindowPos withthe HWND_TOP flag to change the target child window's zorder to put it at the top of the zorder among its siblings.

Note that zorder in child windows only applies to siblings - hwnds with the same parent.

dthorpe