首先,我保证使用一下方法是可行的。步骤如下:
1、修改cygwin文件的环境配置。在cygwin的etc文件夹下的profile文件中添加如下语句,
export PATH=$PATH:"/cygdrive/c/Program Files/Microsoft Visual Studio/COMMON/MSDev98/Bin":"/cygdrive/c/Program Files/Microsoft Visual Studio/VC98/Bin"
export INCLUDE='C:/Program Files/Microsoft Visual Studio/VC98/Include'
export MIDL="midl"
添加完成后,重新启动cygwin,运行midl命令,如果出现:
Microsoft (R) MIDL Compiler Version 5.01.0164
Copyright (c) Microsoft Corp 1991-1997. All rights reserved.
midl : command line error MIDL1000 : missing source-file name
则表示修改cygwin成功。
2、在axvlc.idl文件中添加语句:
HRESULT snapcount([in] int counts);
在axvlc_idl.h文件中添加
virtual HRESULT STDMETHODCALLTYPE snapcount(
int counts) = 0;
HRESULT (STDMETHODCALLTYPE *snapcount)(
IVLCControl* This,
int counts);
#define IVLCControl_snapcount(p,a) (p)->lpVtbl->snapcount(p,a)
在vlccontrol.cpp文件中添加:
STDMETHODIMP VLCControl::snapcount(int counts)
{
HRESULT result = E_UNEXPECTED;
if( _p_instance->isRunning() )
{
int i_vlc;
result = _p_instance->getVLCObject(&i_vlc);
if( SUCCEEDED(result) )
{
VLC_TimeSet(i_vlc, counts, VLC_TRUE);
}
}
return result;
};
在vlccontrol.h文件中添加
STDMETHODIMP snapcount(int counts);
3、在cygwin环境下,到activex目录下,运行midl axvlc.idl命令,如果出现:
$ midl axvlc.idl
Microsoft (R) MIDL Compiler Version 5.01.0164
Copyright (c) Microsoft Corp 1991-1997. All rights reserved.
Processing ./axvlc.idl
axvlc.idl
Processing C:/Program Files/Microsoft Visual Studio/VC98/Include/oaidl.idl
oaidl.idl
Processing C:/Program Files/Microsoft Visual Studio/VC98/Include/objidl.idl
objidl.idl
Processing C:/Program Files/Microsoft Visual Studio/VC98/Include/unknwn.idl
unknwn.idl
Processing C:/Program Files/Microsoft Visual Studio/VC98/Include/wtypes.idl
wtypes.idl
nst@nst330 ~/vlc-0.8.6b/activex
则表示成功添加成功。
4、然后在目录下运行make命令,如果编译成功。
在控件中就成功的添加了一个新的接口snapcount。