strstr(lpstr,"file://") != NULL)
{
RECT rt;
GetClientRect(hWnd, &rt);
DrawText(hdc, lpstr, -1, &rt, DT_LEFT);
}
GlobalUnlock(hMem);
CloseClipboard();
}
EndPaint(hWnd, &ps);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
MFC
程序示例代码
首先要映射以下消息和继承以下函数
afx_msg void OnChangeCbChain(HWND hWndRemove, HWND hWndAfter);
afx_msg void OnDrawClipboard();
afx_msg void OnDestroy();
virtual void OnInitialUpdate();
void CMonitorUrlView::OnInitialUpdate()
{
CListView::OnInitialUpdate();
m_pListCtrl = &GetListCtrl();;
m_pListCtrl->SetExtendedStyle(LVS_EX_FULLROWSELECT |
LVS_EX_GRIDLINES |
LVS_EX_TRACKSELECT |
LVS_EX_TWOCLICKACTIVATE |
LVS_EX_UNDERLINECOLD);
m_pListCtrl->ModifyStyle(LVS_TYPEMASK, LVS_REPORT);
m_pListCtrl->InsertColumn(0, "URL",LVCFMT_LEFT,600,1);
//将本窗口注册到Clipboard Viewer Chain,