1. 用 MFC AppWizard 產生一個 Extension DLL project。

2.增加一個新的Class, myDLL。

3.增加此Class的成員。

4.在宣告此Class的地方,增加 AFX_EXT_CLASS 。

  ex:   class AFX_EXT_CLASS myDLL

           {

              myDLL();

              void function();

              virtual ~myDLL();

           };

5.Build it. 產生 .dll檔和 .lib檔。

使用方法:

1.複製 .lib和 .h檔到client program project。並且include進去。

2.在stdafx.h檔案裡include herder檔案進去。

  ex:  #include "myDLL.h"

3.產生這個Class的物件。

  ex:  class CTestDlg() : public CDialog

        {

          public:
          CDlgTestDlg(CWnd* pParent = NULL); // standard constructor 
          myDLL myIf;

        };

4.直接使用DLL所提供的Function。

  ex: myIf.function();


參考網頁:點此

創作者介紹
創作者 維維 練肖喂~~~ 的頭像
weiwei

維維 練肖喂~~~

weiwei 發表在 痞客邦 留言(0) 人氣( 508 )