Platform SDK Shell >> IDragSourceHelper and alpha-channel-icons

by Timo Kunze » Tue, 24 Feb 2004 21:12:34 GMT

Hi!

In the beginning of a drag'n'drop operation out of my SysTreeView32
window I'm using the following code to get such nice alphablended drag
icons like Windows Explorer:

If Not (IDragSourceHelper Is Nothing) Then
' m_hWnd is the treeview's hWnd, pt is the current cursor position
' and IDataObj is the source's (a shell item) IDataObject
' implementation
IDragSourceHelper.InitializeFromWindow m_hWnd, pt, IDataObj
End If
' now start it
DoDragDrop IDataObj, IDrpSrc, SupportedEffects, VarPtr(WantedEffect)

This works fine. However, if the dragged item's icon has an alpha
channel, all alphablended pixels will be drawn in ugly light-red.

Is there any way to get the icons drawn correctly?

Thanks in advance.
Timo
--
www.TimoSoft-Software.de English: www.en.TimoSoft-Software.de
Stopp TCPA/TCG & NGSCB/Palladium/DRM www.notcpa.org

Platform SDK Shell >> IDragSourceHelper and alpha-channel-icons

by Jim Kueneman » Fri, 27 Feb 2004 11:10:49 GMT



Hi Timo,



VET uses the IDragSourceHelper successfully. What are you returning in
the DI_GETDRAGIMAGE message's SHDRAGIMAGE structure? I have never
gotten this to work (never get the message) and I use
InitializeFromBitmap for VET.



Jim

Posted with XanaNews 1.16.1.11

Platform SDK Shell >> IDragSourceHelper and alpha-channel-icons

by Timo Kunze » Fri, 27 Feb 2004 18:05:47 GMT


I don't process this message - maybe I don't even get it, too. I'll test
for this.
However, you draw the dragimage yourself and pass it to
InitializeFromBitmap, am I right? Actually I wanted to avoid this, but
maybe what I want is too much.

Timo
--
www.TimoSoft-Software.de English: www.en.TimoSoft-Software.de
Stopp TCPA/TCG & NGSCB/Palladium/DRM www.notcpa.org

Platform SDK Shell >> IDragSourceHelper and alpha-channel-icons

by Timo Kunze » Fri, 27 Feb 2004 19:03:08 GMT


I get it. Here's what I do:
(on initialization of my control)
DI_GETDRAGIMAGE = RegisterWindowMessage("ShellGetDragImage")

(on startDragDrop)
IDragSourceHelper.InitializeFromWindow m_hWnd, pt, IDataObj
where pt is in client coordinates
DoDragDrop IDataObj, IDrpSrc, SupportedEffects, VarPtr(WantedEffect)

(in the SysTreeView32's WndProc before forwarding the message to the old
WndProc)
If Msg = DI_GETDRAGIMAGE Then Debug.Print "Gotch ya!"

And it works. I'll play around with SHDRAGIMAGE. Maybe it's easier to
get a Windows-lookalike drag image than I thought.
Maybe SysTreeView32 somehow handles DI_GETDRAGIMAGE automatically. This
could be an explanation why I get a drag image (even if it's a bit
faulty) without ever creating one.

Timo
--
www.TimoSoft-Software.de English: www.en.TimoSoft-Software.de
Stopp TCPA/TCG & NGSCB/Palladium/DRM www.notcpa.org

Platform SDK Shell >> IDragSourceHelper and alpha-channel-icons

by Timo Kunze » Mon, 01 Mar 2004 17:48:33 GMT

*lol* I just discovered that Windows' shell treeviews have this bug,
too. So I'll leave it as it is.

Timo
--
www.TimoSoft-Software.de English: www.en.TimoSoft-Software.de
Stopp TCPA/TCG & NGSCB/Palladium/DRM www.notcpa.org