我用OLE VIEWER从MSN的EXE文件里生成IDL文件后
用MIDL来编译,但是出错了该如何解决?F:\Program Files\Microsoft SDK\Bin>midl c:\msnmsgr.idl
Microsoft (R) 32b/64b MIDL Compiler Version 6.00.0361
Copyright (c) Microsoft Corporation 1991-2002. All rights reserved.
Processing c:\msnmsgr.idl
msnmsgr.idl
Processing F:\Program Files\Microsoft Visual Studio\VC98\include\oaidl.idl
oaidl.idl
Processing F:\Program Files\Microsoft Visual Studio\VC98\include\objidl.idl
objidl.idl
Processing F:\Program Files\Microsoft Visual Studio\VC98\include\unknwn.idl
unknwn.idl
Processing F:\Program Files\Microsoft Visual Studio\VC98\include\wtypes.idl
wtypes.idl
c:\msnmsgr.idl(64) : error MIDL2025 : syntax error : expecting a type specificat
ion near "SESSION_STATE"
c:\msnmsgr.idl(64) : error MIDL2026 : cannot recover from earlier syntax errors;
aborting compilationF:\Program Files\Microsoft SDK\Bin>
**************************************************************************************************************************************************
用MIDL来编译,但是出错了该如何解决?F:\Program Files\Microsoft SDK\Bin>midl c:\msnmsgr.idl
Microsoft (R) 32b/64b MIDL Compiler Version 6.00.0361
Copyright (c) Microsoft Corporation 1991-2002. All rights reserved.
Processing c:\msnmsgr.idl
msnmsgr.idl
Processing F:\Program Files\Microsoft Visual Studio\VC98\include\oaidl.idl
oaidl.idl
Processing F:\Program Files\Microsoft Visual Studio\VC98\include\objidl.idl
objidl.idl
Processing F:\Program Files\Microsoft Visual Studio\VC98\include\unknwn.idl
unknwn.idl
Processing F:\Program Files\Microsoft Visual Studio\VC98\include\wtypes.idl
wtypes.idl
c:\msnmsgr.idl(64) : error MIDL2025 : syntax error : expecting a type specificat
ion near "SESSION_STATE"
c:\msnmsgr.idl(64) : error MIDL2026 : cannot recover from earlier syntax errors;
aborting compilationF:\Program Files\Microsoft SDK\Bin>
**************************************************************************************************************************************************
IDL文件如下// Generated .IDL file (by the OLE/COM Object Viewer)
//
// typelib filename: <could not determine filename>[
uuid(53CED51D-432B-45B2-A3E0-0CE2C24235D4),
version(1.0),
helpstring("Messenger Private Type Library")
]
library MessengerPrivate
{
// TLib : // TLib : OLE Automation : {00020430-0000-0000-C000-000000000046}
importlib("STDOLE2.TLB"); // Forward declare all types defined in this typelib
interface IMsgrSessionManager;
interface IMsgrSession;
interface IMsgrLock;
interface IMessengerPrivate;
dispinterface DMessengerPrivateEvents;
dispinterface DMsgrSessionManagerEvents;
dispinterface DMsgrSessionEvents; [
odl,
uuid(305D86C6-6896-4099-91F5-CB7BA7733563),
helpstring("Messenger Session Manager Interface"),
dual,
oleautomation
]
interface IMsgrSessionManager : IDispatch {
[id(00000000), helpstring("Create a new Session object.")]
HRESULT CreateSession([out, retval] IDispatch** ppSession);
[id(0x00000001), helpstring("Retrieves the session which launched the application.")]
HRESULT GetLaunchingSession(
[in] long lProcessID,
[out, retval] IDispatch** ppSession);
[id(0x00000002), helpstring("Register an app for use with Session Manager.")]
HRESULT RegisterApplication(
[in] BSTR bstrAppGUID,
[in] BSTR bstrAppName,
[in] BSTR bstrAppURL,
[in] BSTR bstrPath,
[in] long ulFlags);
[id(0x00000003), helpstring("Remove an app from the list.")]
HRESULT UnRegisterApplication([in] BSTR bstrAppGUID);
[id(0x00000004), propget, helpstring("Get the collection of applications.")]
HRESULT Applications([out, retval] IDispatch** ppDisp);
}; [
odl,
uuid(42D7CAFC-0167-4941-A5D8-9FD7F104C41A),
helpstring("Messenger Session Interface"),
dual,
oleautomation
]
interface IMsgrSession : IDispatch {
[id(00000000), propget, helpstring("Obtains the application GUID set by the inviter for this session.")]
HRESULT Application([out, retval] BSTR* pbstrAppGUID);
[id(00000000), propput, helpstring("Obtains the application GUID set by the inviter for this session.")]
HRESULT Application([in] BSTR pbstrAppGUID);
[id(0x00000001), propget, helpstring("Gets the current state of the session.")]
HRESULT State([out, retval] SESSION_STATE* pState);
[id(0x00000002), helpstring("Invites user to this session.")]
HRESULT Invite(
[in] IDispatch* pUser,
[in] BSTR bstrAppData);
[id(0x00000003), helpstring("Decline an invitation.")]
HRESULT Decline([in] BSTR bstrAppData);
[id(0x00000004), helpstring("Cancel an invitation.")]
HRESULT Cancel(
[in] long hr,
[in] BSTR bstrAppData);
[id(0x00000005), helpstring("Accept an invitation.")]
HRESULT Accept([in] BSTR bstrAppData);
[id(0x00000006), propget, helpstring("Retrieve the IP address of the other party in the session.")]
HRESULT RemoteAddress([out, retval] BSTR* pbstrRemoteAddress);
[id(0x00000007), propget, helpstring("Retrieve session ID.")]
HRESULT SessionID([out, retval] BSTR* pbstrSessionID);
[id(0x00000008), propget, helpstring("Retrieve the app-specific context data.")]
HRESULT ContextData([out, retval] BSTR* pbstrData);
[id(0x00000009), propget, helpstring("Retrieve the application name.")]
HRESULT ApplicationName([out, retval] BSTR* pbstrName);
[id(0x0000000a), propget, helpstring("Retrieve the application URL.")]
HRESULT ApplicationURL([out, retval] BSTR* pbstrURL);
[id(0x0000000b), propget, helpstring("Retrieve the session flags.")]
HRESULT Flags([out, retval] long* plFlags);
[id(0x0000000c), propget, helpstring("Retrieve the other user.")]
HRESULT User([out, retval] IDispatch** ppUser);
[id(0x0000000d), propput, helpstring("Set the local IP address of the session.")]
HRESULT LocalAddress([in] BSTR pbstrLocalAddress);
[id(0x0000000d), propget, helpstring("Set the local IP address of the session.")]
HRESULT LocalAddress([out, retval] BSTR* pbstrLocalAddress);
[id(0x0000000e), helpstring("Send app-specific context data.")]
HRESULT SendContextData([in] BSTR bstrData);
}; typedef [public]
__MIDL___MIDL_itf_msgrpriv_0000_0001 SESSION_STATE; typedef enum {
SS_UNKNOWN = 0,
SS_READY = 1,
SS_INVITATION = 2,
SS_ACCEPTED = 3,
SS_CONNECTED = 4,
SS_CANCELLED = 5,
SS_DECLINED = 6,
SS_TERMINATED = 7
} __MIDL___MIDL_itf_msgrpriv_0000_0001; [
odl,
uuid(36602AFA-4859-4DF5-820B-BF35ACAA16CA),
helpstring("Messenger Lock and Key Interface"),
oleautomation
]
interface IMsgrLock : IUnknown {
[propget, helpstring("Returns the lock and key status")]
HRESULT _stdcall Status([out, retval] LockStatus* peStatus);
[helpstring("Request lock and key challenge.")]
HRESULT _stdcall RequestChallenge([in] long lCookie);
[helpstring("Send lock and key response.")]
HRESULT _stdcall SendResponse(
[in] BSTR bstrAppStrId,
[in] BSTR bstrResponse,
[in] long lCookie);
}; typedef [public]
__MIDL___MIDL_itf_msgrpriv_0000_0005 LockStatus;
LOCK_NOTINITIALIZED = 1,
LOCK_INITIALIZED = 2,
LOCK_PENDINGRESULT = 3,
LOCK_UNLOCKED = 4,
LOCK_UNLOCKFAILED = 5,
LOCK_DISABLED = 6
} __MIDL___MIDL_itf_msgrpriv_0000_0005; [
odl,
uuid(7C95459B-C8E7-4605-B641-45EB06866659),
helpstring("Messenger Private Interface"),
dual,
oleautomation
]
interface IMessengerPrivate : IDispatch {
[id(0x00000580)]
HRESULT EnableAlertEvents([in, out] SAFEARRAY(long)* ppsaSiteIds);
[id(0x00000581)]
HRESULT AddContact(
[in] BSTR bstrSiginName,
[in] VARIANT vService);
}; [
uuid(D21454F8-43E3-4D64-B1E3-84911BAF207D),
helpstring("Messenger Events for Private Interface")
]
dispinterface DMessengerPrivateEvents {
properties:
methods:
[id(0x00000091)]
void OnLockChallenge(
[in] long lCookie,
[in] BSTR bstrChallenge);
[id(0x00000092)]
void OnLockResult(
[in] long lCookie,
[in] VARIANT_BOOL fSucceed);
[id(0x00000093)]
void OnLockEnable([in] VARIANT_BOOL fEnable);
[id(0x00003000), helpstring("Inform client that the lock status has changed.")]
void OnLockStatusChanged([in] LockStatus eStatus);
[id(0x00000410)]
void OnAlertReceived(
[in] BSTR bstrAlert,
[in, out] VARIANT_BOOL* pBoolfEnableDefault);
[id(0x00000402)]
void OnContactListAdd(
[in] long hr,
[in] IDispatch* pMContact);
}; [
uuid(52AC8B62-8F88-46CA-902A-1F9106B0A9F4),
helpstring("Messenger Events for Session Manager Interface")
]
dispinterface DMsgrSessionManagerEvents {
properties:
methods:
[id(0x00000064), helpstring("A new session invitation has been received.")]
void OnInvitation(
[in] IDispatch* pSession,
[in] BSTR bstrAppData,
[in, out] VARIANT_BOOL* pfHandled);
[id(0x00000065), helpstring("A new application has been registered.")]
void OnAppRegistered([in] BSTR bstrAppGUID);
[id(0x00000066), helpstring("An application has been unregistered.")]
void OnAppUnRegistered([in] BSTR bstrAppGUID);
[id(0x00000091), helpstring("Challenge from server received.")]
void OnLockChallenge(
[in] long lCookie,
[in] BSTR bstrChallenge);
[id(0x00000092), helpstring("Result from server lock and key service.")]
void OnLockResult(
[in] long lCookie,
[in] VARIANT_BOOL fSucceed);
[id(0x00000093), helpstring("Enable/disable lock and key.")]
void OnLockEnable([in] VARIANT_BOOL fEnable);
[id(0x00003000), helpstring("Inform client that the lock status has changed.")]
void OnLockStatusChanged([in] LockStatus eStatus);
[id(0x0000007e), helpstring("Messenger is shutting down.")]
void OnAppShutdown();
}; [
uuid(1847A74F-2E7F-43AF-B7F9-55A4DE3276F5),
helpstring("Messenger Events for Session Interface")
]
dispinterface DMsgrSessionEvents {
properties:
methods:
[id(0x00000067), helpstring("The session state has changed from prevState.")]
void OnStateChanged([in] SESSION_STATE prevState);
[id(0x00000068), helpstring("The app for the invitation is not present.")]
void OnAppNotPresent(
[in] BSTR bstrAppName,
[in] BSTR bstrAppURL);
[id(0x00000069), helpstring("The invitee has accepted the invitation.")]
void OnAccepted([in] BSTR bstrAppData);
[id(0x0000006a), helpstring("The invitee has declined the invitation.")]
void OnDeclined([in] BSTR bstrAppData);
[id(0x0000006b), helpstring("The session has been cancelled.")]
void OnCancelled([in] BSTR bstrAppData);
[id(0x0000006c), helpstring("The session has ended.")]
void OnTermination(
[in] long hr,
[in] BSTR bstrAppData);
[id(0x0000006d), helpstring("The session is approved for launch.")]
void OnReadyToLaunch();
[id(0x00000070), helpstring("The session's application is about to be launched.")]
void BeforeAppLaunch([in, out] VARIANT_BOOL* pfEnableDefault);
[id(0x0000006e), helpstring("New context data has arrived.")]
void OnContextData([in] BSTR bstrContextData);
[id(0x0000006f), helpstring("The last operation failed when sending.")]
void OnSendError([in] long hr);
}; [
uuid(AB1D8565-40E9-4616-984D-98465687E82C),
helpstring("Messenger Private Object")
]
coclass MessengerPriv {
[default] interface IMessengerPrivate;
[default, source] dispinterface DMessengerPrivateEvents;
}; [
uuid(E3A3B1D9-5675-43C0-BF04-37BE11939FB7),
helpstring("Messenger Session Manager Object")
]
coclass MsgrSessionManager {
[default] interface IMsgrSessionManager;
[default, source] dispinterface DMsgrSessionManagerEvents;
}; [
uuid(E3A3B1D8-5675-43C0-BF04-37BE11939FB7),
helpstring("Messenger Session Object"),
noncreatable
]
coclass MsgrSession {
[default] interface IMsgrSession;
[default, source] dispinterface DMsgrSessionEvents;
};
};
请高手帮忙啊
typedef [public]
__MIDL___MIDL_itf_msgrpriv_0000_0001 SESSION_STATE; typedef enum {
SS_UNKNOWN = 0,
SS_READY = 1,
SS_INVITATION = 2,
SS_ACCEPTED = 3,
SS_CONNECTED = 4,
SS_CANCELLED = 5,
SS_DECLINED = 6,
SS_TERMINATED = 7
} __MIDL___MIDL_itf_msgrpriv_0000_0001;
[ Type 'SESSION_STATE' ( Parameter 'prevState' ) ]
c:\msnmsgr.idl(236) : error MIDL2072 : inapplicable attribute : [dual] [ Type '
ESSION_STATE' ( Parameter 'prevState' ) ]
c:\msnmsgr.idl(60) : error MIDL2072 : inapplicable attribute : [oleautomation]
Type 'SESSION_STATE' ]
c:\msnmsgr.idl(60) : error MIDL2072 : inapplicable attribute : [dual] [ Type 'S
SSION_STATE' ]
c:\msnmsgr.idl(60) : error MIDL2270 : duplicate UUID. Same as : SESSION_STATE [
Type 'SESSION_STATE' ]
c:\msnmsgr.idl(94) : error MIDL2072 : inapplicable attribute : [oleautomation]
Type 'SESSION_STATE' ( Parameter 'pState' ) ]
c:\msnmsgr.idl(94) : error MIDL2072 : inapplicable attribute : [dual] [ Type 'S
SSION_STATE' ( Parameter 'pState' ) ]
c:\msnmsgr.idl(88) : error MIDL2079 : no [uuid] specified : [ Interface 'IMsgrS
ssion' ]
c:\msnmsgr.idl(39) : error MIDL2079 : no [uuid] specified : [ Library 'Messenger
Private' ]
c:\msnmsgr.idl(240) : error MIDL2270 : duplicate UUID. Same as : SESSION_STATE [
Type 'SESSION_STATE' ( Parameter 'prevState' ) ]
c:\msnmsgr.idl(98) : error MIDL2270 : duplicate UUID. Same as : SESSION_STATE [
Type 'SESSION_STATE' ( Parameter 'pState' ) ]
release\msnmsgr.tlh(21) : fatal error C1004: unexpected end of file found
Error executing cl.exe.这个tlh文件我无法修改,每次编译的时候VC都会重新生成一个。。
SS_UNKNOWN = 0,
SS_READY = 1,
SS_INVITATION = 2,
SS_ACCEPTED = 3,
SS_CONNECTED = 4,
SS_CANCELLED = 5,
SS_DECLINED = 6,
SS_TERMINATED = 7
} __MIDL___MIDL_itf_msgrpriv_0000_0001;
放到idl文件的开头!
在include下面就行了!
release\msnmsgr.tlh(21) : fatal error C1004: unexpected end of file found
Error executing cl.exe.