easyirqsample.cpp
来自「windows9X下进行中断编写的Dll及实例源码」· C++ 代码 · 共 38 行
CPP
38 行
#include <windows.h>
#include <conio.h>
#include "easyirq.h"
// the function that is called every IRQ
void __stdcall irqHandler(DWORD irqNum) {
MessageBox(0, "IRQ here !", "", 0);
}
int PASCAL WinMain (HANDLE hInstance, HANDLE hPrevInstance, LPSTR lpszCmdParam, int nCmdShow) {
// turn on IRQ 7 handling
if ( easyIrq(7, TRUE, &irqHandler) ) {
MessageBox(0, "some error", "error", 0);
return 1;
}
// enable printer port interrupts (transition of the Ack signal on pin 10 of the 25-pin connector)
_outp(0x378 + 2, 16);
// just wait irqs
MessageBox(0, "click OK to finish", "", 0);
// disable printer port interrupts
_outp(0x378 + 2, 0);
// turn off IRQ 7 handling (mask irq)
easyIrq(7, FALSE, &irqHandler);
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?