C语言怎样构造窗口

来源:百度知道 编辑:UC知道 时间:2024/06/16 18:35:33
怎么C的程序全是在DOS窗口中,怎样写出一个普通的窗口,就向VB那样,求!

其实可以用代码实现,但是这个比较复杂不想VB那样简单。为此你必须写一些接近硬件的函数,而且要写写函数对显示模式进行设置。主要过程是 设置显示模式 --保存显示器内容-----载入菜单---接收用户选择----恢复显示内容,这些过程全部要自己写代码实现。
给你个大概的代码
int int86(num,inregs,outregs)
int num//the interruptnumber
union REGS *inregs //the input register values
union REGS *outregs //the output register values
INT86()函数返回的是AX中的值
REGS的定义在 DOS.H中
struct WORDREGS//对寄存器用16位操作
{
unigned int ax,bx,cx,dx,si,di,cflag;
};
struct BYTEREGS//对寄存器用8位操作
{
unsiged char al,ah,bl,bh,cl,ch,dl,dh;//bh存显示页号dh存光标行号dl列号
};
union REGS
{
struct WORDREGS x;
struct BYTEREGS h;
};
void goto_xy(x,y)//send the cursor to x,y用了10H功能号2
int x,int y;
{ union REGS r;
r.h.ah=2;//curor addressing funciton
r.h.dl=y;
r.h.dh=x;
int86(0x10,&r,&r);
}
//中断10H的子功能号8,字符ascii存在al寄存器属性存在AH
//save a portion of the screen
void save_video(startx,endx,starty,endy,buf_ptr)
int startx,e