开发者

drag and drop problem

开发者 https://www.devze.com 2022-12-21 18:43 出处:网络
I have an Application and want to drop a file in it. I used the COleDropTarget class and derived from it. In my CMainFrame class in the methode OnCreate I register it. This return true.

I have an Application and want to drop a file in it. I used the COleDropTarget class and derived from it. In my CMainFrame class in the methode OnCreate I register it. This return true.

When OnDrop get开发者_如何学运维s called pDataObject->GetFileData(CF_TEXT); or even pDataObject->IsDataAvailable(CF_TEXT) returns 0.

Can someone tell me why?

Thanks


Dropping a file doesn't have the data type CF_TEXT but CF_HDROP. You have to check for that and then extract the file paths from the CF_HDROP structure.

To get the paths from the CF_HDROP structure, use the DragQueryFile API.

0

精彩评论

暂无评论...
验证码 换一张
取 消