Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Drag and Drop in CHtmlView Collapse All
Subject Author Date
Chun Pong Lau Dec 10, 2006 - 9:25 AM

Dear support team,

I tried to add drag and drop function with COleDropTarget to a CHtmlView derived class which is used inside CExtTabPageContainerWhidbeyWnd. However, the overriden OnDrop function is never called when an object to drag and drop to the it. Please advice.

Due to a tight deadline, it is highly appreciated if a demo can be provided. Thanks for your kindness very much.

Best regards,
Alan

Suhai Gyorgy Dec 11, 2006 - 4:25 AM

To make a demo, some more information would be needed:

a) Is it an MDI application, with CHtmlView being your document’s view?
b) Does your CHtmlView derived class have a COleDropTarget member variable and did you call COleDropTarget::Register( this ) for this variable in the view’s OnCreate?
c) Did you implement OnDragEnter, OnDragOver, OnDragLeave methods for your view?

b) and OnDragOver from c) are essential for OnDrop to work. In FormEditor sample you can check how it is done (look in FormEditorView class)

Chun Pong Lau Dec 15, 2006 - 2:10 PM

a) it is a SDI with a derived CHtmlView class
b) yes. i’ve implemented COleDropTarget and register it in the view’s oncreate
c) yes. i’ve implemented them all.
d) I followed FormEditor sample but it doesn’t help.

What is more in my application is that I am using AExtTabPageContainerWhidbeyWnd.

I would appreciate your help very with a workable demo with drag and drop function meeting the above requirments.

Thanks a lot.

Alan

Technical Support Dec 16, 2006 - 10:57 AM

First of all, please check the following issues:

1) You have initialized the OLE subsystem using ::AfxOleInit() (MFC API) or ::OleInitialize() (Win32 API). If you are using ::CoInitialize(), the OLE drag-and-drop will not work.

2) The CHtmlView class is a container window for the web browser ActiveX control. The later contains several child windows having the same size. We have no idea why several windows are used in the web browser but this means you should register the drop target only for the bottom window, which is typically has the Internet Explorer_Server window class name (we used SPY++ to determine this). So you should play with this and you may even need to unregister the drop target which was registered by the web browser control by default.

3) In any case described in (2), verify whether the COleDropTarget::Register() MFC’s API returns the successful result.

Chun Pong Lau Dec 16, 2006 - 12:06 PM

Dear support team,

We’ve tried all of points you have raised but failed to get the OnDrop function called.

Would you please try if you can compile one successful application to demonstrate the result? We think it’s not a trivial task according to what we have tested and researched.

One additional information is that we are using Visual C++ 2005.

Best regards,
Alan

Technical Support Dec 17, 2006 - 8:02 AM

Non-triviality of this task is not a problem. The real problem is that the solution described in our previous message is applicable to IE6 and IE7 only. The later versions of IE may have an absolutely different internal structure. Why don’t you use some alternative solution? For instance, you could create a small pop-up window that can be used as the drop target basket.

Chun Pong Lau Dec 17, 2006 - 3:46 PM

Thanks for your response but our target is aiming at IE6 and IE7 only and a pop-up window solution may not be suitable to us because we would need a direct drag and drog to the CHtmlView by requirement.

Best regards,

Alan

Suhai Gyorgy Dec 18, 2006 - 8:55 AM

I did as Support suggested in their last post: Do a search on the Internet. I found this thread on CodeProject about this issue. Hope it can help you as well. Also check out CHtmlView::OnGetDropTarget method in MSDN Help.

Chun Pong Lau Dec 18, 2006 - 5:55 PM

Dear Suhai,

Thanks for your response.

I referenced this codeproject article before I consulted the support team. I also followed the suggestion in http://www.codeproject.com/shell/explorerdragdrop.asp?forumid=1699&exp=0&mpp=50&select=1224117&df=100#xx1224117xx and http://www.vckbase.com/document/viewdoc/?id=1486. The result is I can catch the OnDragEnter, OnDragOver and OnDragLeave but never OnDrop (even I implemented the DROPEFFECT_MOVE in OnDragEnter and OnDragOver).

When I searched I also found http://www.eggheadcafe.com/forumarchives/vcmfc/sep2005/post23916981.asp. Dave mentioned it is a bug in VC7.0 and someone suggested to override CHtmlView::CreateControlSite but it doesn’t work to me.

Alan





Suhai Gyorgy Dec 19, 2006 - 2:39 AM

Dear Alan,

It pretty much seems like it’s not the CExtTabPageContainerWhidbeyWnd to blame, but just to rule this out, have you tried to implement drag and drop without using CExtTabPageContainerWhidbeyWnd?

This way or another, maybe we could spot something in your code if you upload a stripped version of your application, which represents the problem, so we can take a look.

Best regards,
Chris.

Technical Support Dec 18, 2006 - 6:33 AM

Actually we don’t have a task to code such a sample in our to do-list because it’s quite specific. You could try making a search over the Internet or may be somebody agree to code such a sample.