HDROP issue

Posted on 2006-04-02
Last Modified: 2013-11-20

I currently have some code triggered on the DrawClipboard event that looks for copied files in the clipboard format of HDROP, the code works great except for one problem; when my app is running and I copy a file in a folder using CTRL+C the code is triggered and then when I close the folder window because Im done copying my code is triggered again causing a duplicate copy. My question is, does closing a window after a copy usually trigger a DrawClipboard event? I didnt include any code but can if you think its a problem with my code. This is driving me crazy because I have no idea how to stop the duplicate entries.
Question by:rushtheweb
    LVL 22

    Expert Comment

    Each window that receives an OnDrawClipboard call should call the SendMessage Windows function to pass a WM_DRAWCLIPBOARD message on to the next window in the Clipboard-viewer chain. The handle of the next window is returned by the SetClipboardViewer member function; it may be modified in response to an OnChangeCbChain member function call.

    Also Each CWnd object that receives an OnChangeCbChain call should use the SendMessage Windows function to send the WM_CHANGECBCHAIN message to the
    next window in the Clipboard-viewer chain (the handle returned by SetClipboardViewer). If hWndRemove is the next window in the chain, the window specified by hWndAfter becomes the next window, and Clipboard messages are passed on to it.  Look at ChangeClipboardChain() and SetClipboardViewer().


    LVL 22

    Accepted Solution

    Also consider each message to indicate a change, unconditionally. Programs like Word often put stuff on the clipboard with delayed rendering ,the actual data
    is only provided when some app asks for it. When they close they copy the actual data to the clipboard to it stays available after the app has gone away,hence the message.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Suggested Solutions

    Title # Comments Views Activity
    Windows Drag & Drop Location 2 79
    move a line in eclipse 3 45
    Annoying "thing" blocks my view 4 27
    wordmultiple challenge 12 58
    Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
    Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
    This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    794 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now