编译时出现
G:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\VC98\INCLUDE\urlmon.idl(1314) : error MIDL2025 : syntax error : expecting a type specification near "HANDLE_PTR"
G:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\VC98\INCLUDE\urlmon.idl(1315) : error MIDL2026 : cannot recover from earlier syntax errors; aborting compilation 
执行 midl.exe 时出错.我应该怎么办呢?urlmon.idl就是vc自带的那个,vc自带的文件也会有问题吗?
顺便问一下,谁有带IDownloadManager接口的tlb文件?请给个下载地址,多谢附上downloadmgr.idl代码:
//+-------------------------------------------------------------------------
//
//  Microsoft Windows
//  Copyright 1995-2000 Microsoft Corporation. All Rights Reserved.
//
//--------------------------------------------------------------------------cpp_quote("//=--------------------------------------------------------------------------=")
cpp_quote("// downloadmgr.h")
cpp_quote("//=--------------------------------------------------------------------------=")
cpp_quote("// (C) Copyright 2000 Microsoft Corporation.  All Rights Reserved.")
cpp_quote("//")
cpp_quote("// THIS CODE AND INFORMATION IS PROVIDED \"AS IS\" WITHOUT WARRANTY OF")
cpp_quote("// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO")
cpp_quote("// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A")
cpp_quote("// PARTICULAR PURPOSE.")
cpp_quote("//=--------------------------------------------------------------------------=")
cpp_quote("")
cpp_quote("#pragma comment(lib,\"uuid.lib\")")
cpp_quote("")
cpp_quote("//---------------------------------------------------------------------------=")
cpp_quote("// Internet Explorer Download Manager Interfaces")
cpp_quote("")
cpp_quote("// --------------------------------------------------------------------------------")
cpp_quote("// GUIDS")
cpp_quote("// --------------------------------------------------------------------------------")
cpp_quote("// {988934A4-064B-11D3-BB80-00104B35E7F9}")
cpp_quote("DEFINE_GUID(IID_IDownloadManager, 0x988934a4, 0x064b, 0x11d3, 0xbb, 0x80, 0x0, 0x10, 0x4b, 0x35, 0xe7, 0xf9);")
cpp_quote("#define SID_SDownloadManager IID_IDownloadManager")#ifndef DO_NO_IMPORTS
import "unknwn.idl";
import "ocidl.idl";
import "oleidl.idl";
import "oaidl.idl";
#endif
interface IDownloadManager;
[
    helpstring("IDownloadManager interface"),
    object,
    uuid(988934A4-064B-11D3-BB80-00104B35E7F9), // IID_IDownloadManager
    pointer_default(unique),
    local
]
interface IDownloadManager : IUnknown
{
    HRESULT Download(
        [in] IMoniker *pmk,         // Identifies the object to be downloaded
        [in] IBindCtx *pbc,         // Stores information used by the moniker to bind 
        [in] DWORD dwBindVerb,      // The action to be performed during the bind
        [in] LONG grfBINDF,         // Determines the use of URL encoding during the bind
        [in] BINDINFO *pBindInfo,   // Used to implement IBindStatusCallback::GetBindInfo
        [in] LPCOLESTR pszHeaders,  // Additional headers to use with IHttpNegotiate
        [in] LPCOLESTR pszRedir,    // The URL that the moniker is redirected to
        [in] UINT uiCP              // The code page of the object's display name
    );
};

解决方案 »

  1.   

    依现象看,楼主可能没有正确包含Include等路径.
    因为错误提示"expecting a type specification near "HANDLE_PTR" ",说明编译器不认识HANDLE_PTR,请Include含有HANDLE_PTR声明的文件,然后再试试.
    GOOD LUCK.
      

  2.   

    那么哪个文件里有HANDLE_PTR的声明呢?请赐教
      

  3.   

    如果只是HANDLE_PTR不识别的话,你直接加入typedef unsigned __int64 HANDLE_PTR;
    就行了。
      

  4.   

    vc6 吗? 打一下 sp6补丁, 然后下载 sdk2003 应该就可以了
      

  5.   

    to sjdev(道不行,乘桴浮于海.) :
        你好,用了你的方法,不提示之前的错误了,可又出现了新的错误:
    G:\Program Files\Microsoft Visual Studio\VC98\Include\UrlMon.Idl(1940) : error MIDL2025 : syntax error : expecting a type specification near "DWORD_PTR"
    G:\Program Files\Microsoft Visual Studio\VC98\Include\UrlMon.Idl(1941) : error MIDL2026 : cannot recover from earlier syntax errors; aborting compilation 
    该怎么办呢?
      

  6.   

    感谢各位,编译时已经不出错了,最后弱弱的问一句,编译出来的tlb文件在哪里?
      

  7.   

    默认情况下生成的类型库文件(tlb)应该和dll在同一个目录吧。
      

  8.   

    那为什么编译完了没有错误,我却找不到生成的文件?
    能否说一说编译idl文件的过程和需要哪些设置?
      

  9.   

    呵呵,源码目录下有tlb文件吗?没有的话,右键点击File View中的idl文件->选择编译。