次の方法で共有


Why doesn't drag/drop work with BindEvents?

In this post: Is this a bug in BindEvents? I asked why drag/drop wasn’t working.

The code to dispatch methods or events to the appropriate user routines tests to see if the user has bound code that might occur before or after calling the target code. If additional bound code needs to be executed, then all the parameters need to be copied to temporary storage, the routine is called, then all the parameters are pushed again on the stack for the 2nd routine. Thus if a parameter is passed by reference, changes made by the 1st routine invoked would be discarded, resulting in perhaps broken behavior. Thus, SDavila was correct that the reason was because of a parameter passed by reference, but it’s not the DataObject parameter. nEffect is passed by reference.

Start Task Manager, Solution Samples and search for “Drag” to look for more sample code for Drag and Drop.

Also, MSDN describes IDropTarget::DragOver which passes nEffect by reference.

Comments

  • Anonymous
    March 08, 2006
    A customer had a question and sent some code:
     
    PUBLIC oHandler
    oHandler = NEWOBJECT("StatusBarText")...