To install MSXML manually
注冊msxml4.dll
Copy the DLLs to the system directory on your working machine.
Register the DLLs by typing the following at a command prompt:
cd c:\windows\system32
regsvr32 msxml4.dll
兩種配置方式
There are two ways to instruct your application to use the DOM interfaces:
第一種是自動的,最簡單
1)To include headers and libraries automatically
Add the following two lines to your source code:
#import <msxml4.dll> raw_interfaces_only
using namespace MSXML2;
The raw_interfaces_only flag to #import directive suppresses the creation of "smart pointer" C++ wrapper classes. In many cases, however, these wrappers are quite useful and make working with CDO in C++ very simple.
raw_interfaces_only 該屬性只允許展示類型庫的低級內容。
第二種是手工的,復雜
2)To include headers and libraries manually
1. Locate the SDK directory installed by the appropriate MSXML package.
For example, your directory might be C:\msxml4\sdk, with subdirectories named inc and lib.
2. Add your directory to the standard include path.
To do this in Visual C++, open the Options... panel from the Tools menu. Click the Directories tab, then select Include files from the Show directories for drop-down menu. Add your directory name, such as "C:\msxml4\sdk\inc", to the Directories textbox.
這里說的是VC6.0
3. Add your directory to the system library path.
To do this in Visual C++, open the Options... panel from the Tools menu. Click the Directories tab. Select Library files from the Show directories for drop-down menu. Add your directory name to the Directories textbox.
4. Include the required MSXML header file by inserting the following macro into the source code:
#include <msxml2.h>
5. Link msxml2.lib to your project.
To do this in Visual C++, open Project Settings by clicking Settings from the Project menu. Select the Link tab. Append "msxml2.lib" to the Object/library modules: textbox.