« 神奇的李小龍~~~~ | 回到主頁面 | 文不如圖~ 圖不如自動播放? MS Producer 2003 »

December 08, 2004

VC++ 關於使用OLE Drag and Drop的補充


將此網頁加入【百度收藏】... 加入此網頁到【del.icio.us 書籤】 technorati

[圖片來自The Code Project]

如果有人依據How to Implement Drag and Drop Between Your Program and Explorer的文章自己將他的Class加入自己程式之中,或許會發現無法順利將CMyDropTarget 順利的在自己程式中Register,尋找一些書籍之後,我在MFC (Programming Windows with MFC, 2/e)中Putting It All Together: The Widget Application尋找出解決的方式

那是因為程式沒有對於OLE做起始化的設定,請在自己程式引用

#include <afxole.h>

並且在::InitInstance()加入

 if (!AfxOleInit ()) {
     AfxMessageBox (_T ("AfxOleInit failed, you may not use drag and drop"));
  return FALSE;
    }


就可以了~~~~



VC6相關問題

由 Evan 發表於 December 08, 2004 將此網頁加入【百度收藏】... 加入此網頁到【del.icio.us 書籤】 technorati
引用
本文的引用網址:


以下是前來引用的連結 'VC++ 關於使用OLE Drag and Drop的補充' 來自 Blog E
Google
迴響
發表迴響









記住我的資訊?




(請輸入以下的驗證碼)