1

I have a program that displays a main window, a layered window and implements COM drag and drop. In general terms:

  1. I create a normal top level window.
  2. I create a layered window using WS_EX_LAYERED and UpdateLayeredWindow/SetLayeredWindowAttributes (I've tried both). The layered window sits on top of the window created in 1. The layered window is not a child window.
  3. I then begin a drag and drop via the COM DoDragDrop function. In IDropSource::QueryContinueDrag I call ImageList_BeginDrag, ImageList_DragMove and so on.

The problem is, the drag image that COM is showing (it's an image in the image list) is displayed underneath the layered window instead of on top of it. The cursor is displayed on top of the layered window (as expected). From bottom to top, the layering I am getting is:

  • Main window (bottom)
  • COM drag image
  • Layered window
  • Cursor (top)

What it should be is:

  • Main window (bottom)
  • Layered window
  • COM drag image
  • Cursor (top)

I have already applied KB943326 "Overlapping layered windows are not displayed in the correct order in Windows Server 2003 or in Windows XP" ("http://support.microsoft.com/kb/943326"), but it made no difference.

I am running XP SP2.

Any suggestions appreciated as I have run out of ideas...

Thanks, Su Green

Su Green
  • 11
  • 1
  • if your layered window is not a child, how do you gurantee that it sits on top of the main window? – John Knoeller Dec 22 '09 at 20:11
  • By creating if after the main window. It must be done this way because layered windows aren't allowed to be child windows (they fail to create if you try to do it). Luckily, in this case it doesn't matter because nothing else is happening during the drag and the layered window is destroyed when the drag ends. – Su Green Dec 22 '09 at 20:27
  • Is it created after the drag operation begins? – John Knoeller Dec 22 '09 at 21:24
  • You can create your layeredwindow by passing it a hWndParent without a WS_CHILD. It'll create an owned window and solve order. Not sure it'll solve the drag&drop image order though. – Emmanuel Caradec Jan 11 '10 at 12:36

0 Answers0