We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now


HDROP issue

rushtheweb asked
Medium Priority
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.
Watch Question

mahesh1402IT Professional
Top Expert 2005

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().


IT Professional
Top Expert 2005
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.


Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.