Click here to Skip to main content
15,509,455 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to refresh CMFCShellListCtrl after windows finihed paste. I use WM_DRAWCLIPBOARD, but the resulet is not what I want.
I also write a cut function, it wroks and can be used by paste. But after I finish paste, the paste button is still available, so how to "clear" clipboard?
Thanks to everyone's help at first!

C++
void CFilesBrowserView::OnDrawClipboard()
{
	CFormView::OnDrawClipboard();

	// TODO: Add your message handler code here
	if(OpenClipboard())
    {
		if(::IsClipboardFormatAvailable(CF_HDROP) && ::GetFocus()!=m_fileList.m_hWnd)
			m_fileList.Refresh();  //refresh
		CloseClipboard();
	}
Posted
Comments
enhzflep 26-Nov-14 4:06am    
Perhaps you're looking for this?BOOL EmptyClipboard(VOID);
Kai Lu 27-Nov-14 2:59am    
Hi, thanks for your reminder. I ever also used this function, but it didn't work. Then I tird it again today, I found a bug in my program, it works!!
Do you know how to get the paste message after finished paste?
Jochen Arndt 27-Nov-14 5:32am    
There is no callback mechanism for clipboard operations. Once you have copied something to the clipboard the data is owned by the clipboard. This is because the source application from where you have copied may have been already closed when the data is pasted by another application.
Kai Lu 1-Dec-14 11:35am    
Hi Jochen, thanks for your detail explaining. But I still have one doubt, if I open two file exploers in windows, then I delete or clip one file in one exploer, the other exploer will know I should refresh now. So do you know the mechanism?
Thanks!
Jochen Arndt 1-Dec-14 12:10pm    
I don't know exactly how the file Explorer does that. It probably monitors the directory for changings using one of the Windows API functions for file monitoring or just checks the modified time stamp of the directory entry in intervals (it will be updated when the folder content changes).

However, this applies only to folders actually opened in the Explorer and not to other applications and other clipboard fromats.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900