ITPub博客

首页 > Linux操作系统 > Linux操作系统 > msxml 安装使用

msxml 安装使用

原创 Linux操作系统 作者:willlxy 时间:2009-02-09 10:31:09 0 删除 编辑

msxml 安装使用

msxml就不用多介绍了,直接讲怎么让你程序可以用它吧
开始要去网上下msxml_SDK.
 
看下面的东东吧,肯定对你有用。
 
Set Up My Visual C++ 6.0 Project

For simplicity and clarity, the C/C++ applications presented in this tutorial are constructed as Win32 console application projects in Microsoft Visual Studio. The procedure below outlines the steps to build and run such a project.

This topic gives the procedure for setting up Visual C++ 6.0. The steps in this procedure are fundamentally the same as for Visual Studio 2005. If you need to set up a project for Visual Studio 2005, please see Set Up My Visual C++ Project.

To create a new Win32 console application project

  1. Start Visual C++.

  2. From the File menu, select New. On the Projects tab of the New dialog box that appears, select Win32 Console Application in the left pane. Then type the name of the project (in this case, "trivialProj") in the Project name field. For the project Location field, either accept the default setting or choose another location (e.g., c:\examples\HowDoI). Click OK.

  3. The Win32 Console Application property page will appear. For the type of Console Application, select An empty project and click Finish. When the New Project Information box displays, click OK.

  4. Set up the include directory for Visual Studio. From the Tools menu, select Options. Select the Directories tab if it is not already selected. Select Include files in the Show directories for drop down box. Add a new line to the list of directories. Browse to the directory that contains the MSXML header file. For MSXML 3.0, by default, the directory is C:\Program Files\Microsoft XML Parser SDK\inc. For MSXML 4.0, by default, the directory is C:\Program Files\MSXML 4.0\inc. Click OK.

  5. Set up the lib directory for Visual Studio. From the Tools menu, select Options. Select the Directories tab if it is not already selected. Select Library files in the Show directories for drop down box. Add a new line to the list of directories. Browse to the directory that contains the MSXML libraries. For MSXML 3.0, by default, the directory is C:\Program Files\Microsoft XML Parser SDK\lib. For MSXML 4.0, by default, the directory is C:\Program Files\MSXML 4.0\lib. Click OK.

  6. Modify the project to link with the appropriate MSXML library. From the Project menu, select Settings. Select the Link tab. Click in the Object/library modules text edit box. Press the End key to move the insertion point to the end of the list of libraries. Enter the appropriate library name. For MSXML 3.0 and 4.0, the library name is msxml2.lib. For MSXML 6.0, the library name is msxml6.lib. Click OK.

Now you are ready to add source, header, and resource files to the project. For a clear illustration, each task in the How Do I Program with DOM in C++ tutorial is implemented as a standalone Win32 console application. The following skeleton code shows the general layout of these applications.

Source Listing for a Trivial Application (trivial.cpp)

#include 
#import  raw_interfaces_only
using namespace MSXML2;
int main(int argc, char* argv[])
{
   CoInitialize(NULL);
   printf("start using msxml3.dll... \n");

   // Add your code here.

   CoUninitialize();
   return 0;
}

To add source code to your project

  1. Select FileView on the project browser, and highlight your project files (in this case, trivialProj files). From the File menu, select New.

  2. On the Files tab of the New dialog box, highlight C++ Source File. Then type the name of the C++ source file (in this case, "trivial.cpp") in the File name text box.

  3. Click OK.

  4. Copy the source code snippet above and paste it into the file you've just created.

    NoteNote

    Before using any COM module, you must initialize the COM library by calling the CoInitialize(NULL) function in your application. You then must close the COM library by calling the CoUninitialize() function before the application exits.

To build and run the application

  1. To test the application while in the development environment, select Build TrivialProj.exe from the Build menu.

  2. When the application is built without errors, run the application by selecting Execute TrivialProj.exe from the Build menu.

When you build and run trivial.cpp, you should get the following output:

start using msxml3.dll...

You are now ready start working with XML DOM.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/17267437/viewspace-545634/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2009-01-07

  • 博文量
    28
  • 访问量
    84189