②audcard.cpp
//audcard.cpp - main module for vxd audcard
#define device_main
#include "audcard.h"
declare_virtual_device(audcard)
#define wm_user_postvxd 0x1000 //自定义消息
#undef device_main
audcardvm::audcardvm(vmhandle hvm) : vvirtualmachine(hvm) {}
audcardthread::audcardthread(threadhandle hthread) : vthread(hthread) {}
bool audcarddevice::onsysdynamicdeviceinit() //动态加载时初始化
{
......//硬件初始化
pmyirq=new myhwint();
if(pmyirq&&pmyirq->hook()) //挂接中断
{
pmyirq->physicalunmask(); //允许中断
return true;
}
else return false;
}
bool audcarddevice::onsysdynamicdeviceexit()
//动态卸载过程
{
delete pmyirq;
return true;
}
dword audcarddevice::onw32deviceiocontrol(pioctlparams pdiocparams)
//与win32应用程序的接口函数
{
......
}
void myhwint::onhardwareint(vmhandle hvm)
{
...... // 中断处理
shell_postmessage(appwnd,wm_user_postvxd ,0,0,0,null);
//向应用程序窗口发送消息
sendphysicaleoi(); //通知vpicd中断结束
}
(作者地址:南京通信工程学院98信箱 210016 收稿日期:1998.12.03)