Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Drop file into ActiveX inside IE

24 views
Skip to first unread message

Steven Tang

unread,
Jan 13, 2009, 11:56:09 AM1/13/09
to
Hello,
I try to add drop file function to my activex control which inside IE,
anyway when I try to drag and drop file into its control, IE always intercept
it, inside the activex, I already set acceptDropFile to true and handled
WM_DROPFILES
message, how to make activex get the drop file message?

Best Regards

Steven Tang

Jialiang Ge [MSFT]

unread,
Jan 14, 2009, 2:51:14 AM1/14/09
to
Good morning Steven

Here are two quick ideas of how to make ActiveX get the drop message. You
may have been using the idea, but it's just for your references. I'm
performing more researches on this issue.

============================
Quick Idea 1

I suggest that you make sure that the ActiveX control implements
IObjectSafety interface. Only when a control is marked as safe can it
accept other windows messages. You may want to read these articles:

http://support.microsoft.com/kb/182598
http://support.microsoft.com/kb/161873
http://support.microsoft.com/kb/216434
http://support.microsoft.com/kb/168371

http://www.codeproject.com/KB/COM/firingeventsamongactivex.aspx
http://www.codeproject.com/KB/atl/ScriptableActiveX.aspx

============================
Quick Idea 2

Are you running IE in protected mode? If yes, these two articles deserve
your reading:

http://msdn.microsoft.com/en-us/library/bb250462.aspx
http://www.codeproject.com/KB/vista-security/PMSurvivalGuide.aspx

Especially the section "Drag and Drop to Other Applications" in the second
article. The article not only explains the reason for the behavior, but
also provides the solution of the issue.

If the above quick ideas are helpful to you, please kindly let me know. I'm
researching other ideas and will report back if I have any progress.

Have a nice day!

Regards,
Jialiang Ge (jia...@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msd...@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

MSDN Managed Newsgroup support offering is for non-urgent issues where an
initial response from the community or a Microsoft Support Engineer within
2 business day is acceptable. Please note that each follow up response may
take approximately 2 business days as the support professional working with
you may need further investigation to reach the most efficient resolution.
The offering is not appropriate for situations that require urgent,
real-time or phone-based interactions. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Steven Tang

unread,
Jan 14, 2009, 5:16:02 PM1/14/09
to
Hello Jialiang,
Thank you very much for helping.
1. My IE is protected off
2. I implemented IObjectSafety inside the ActiveX control
3. I also modified DllRegisterServer to mark the control "safe"
in the registry.

But the IE still intercept the DROP file message to the AX control.
Any more hint?
--
=======================
Steven Tang
SYWWUYU)
**:)

Jialiang Ge [MSFT]

unread,
Jan 15, 2009, 6:42:48 AM1/15/09
to
Hello Steven

We need to register the ActiveX control as the one to receive these events.
Here are several common mistakes that causes the dropfile event not to be
fired. If they do not apply to your control, do you mind sending a
reproducible project to me (jia...@microsoft.com)? I will test the project
on my side and try to figure out the error.

>> Common Mistake 1

For MFC activex controls CoInitialize() is used, but we need to call
OleInitialize() to have services like drag and drop, clipboard. So creating
an object of type COleDropTarget allows this through OLE
drag drop mechanism. When you create a COleDropTarget and register it in
the control, the MFC plumbing will take care of ensuring that it calls your
OnDropFiles method once the WM_DROPFILES message is fired.

>> Common Mistake 2

Another common mistake is that we miss the following PX_XXX code for
parameters to work from script:

void CXAcitveXCtrl::DoPropExchange(CPropExchange* pPX)
{
ExchangeVersion(pPX, MAKELONG(_wVerMinor, _wVerMajor));
COleControl::DoPropExchange(pPX);

// TODO: Call PX_ functions for each persistent custom property.
PX_Long(pPX,"BackgroundColor",m_backgroundColor);
}

(Suppose that BackgroundColor is a PARAM in the OBJECT tag:

<OBJECT ID="XFTP1" WIDTH=450 HEIGHT=346 ALIGN=TOP
CLASSID="CLSID:5C3729C9-6ED9-4A36-BF5A-2BF16CB586BD">
<PARAM NAME="BackgroundColor" VALUE=255>
.....
)

Best Regards


Jialiang Ge (jia...@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

=================================================


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msd...@microsoft.com.

This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================

Steven Tang

unread,
Jan 17, 2009, 12:44:01 AM1/17/09
to
After IDropTarget and it works.

Thanks a lot for helping.

=======================
Steven Tang
SYWWUYU)
**:)


""Jialiang Ge [MSFT]"" wrote:

> ......

Jialiang Ge [MSFT]

unread,
Jan 18, 2009, 10:34:20 PM1/18/09
to
You are welcome!

Glad to be of assistance. :-)

Regards,

0 new messages