| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 5174 人关注过本帖
标题:念初中时编的dos 6.22启动盘源代码,现在好像不用了,把原码贴出来,高手见 ...
取消只看楼主 加入收藏
yuki
Rank: 2
等 级:新手上路
威 望:5
帖 子:508
专家分:0
注 册:2005-2-4
收藏
 问题点数:0 回复次数:7 
念初中时编的dos 6.22启动盘源代码,现在好像不用了,把原码贴出来,高手见笑了。。

/* App.H */ #include <stdio.h> #include <stdlib.h> #include <graphics.h> #include <conio.h> #include <string.h> #include <dos.h> #include <dir.h> #include <bios.h>

#define UPKEY 0x4800 #define DOWNKEY 0x5000 #define ESC 0x011b #define ENTER 0x1c0d #define F1 0x3b00

void initDrv(void){ int gdriver = DETECT, gmode, errorcode; initgraph(&gdriver, &gmode, ""); errorcode = graphresult(); if (errorcode != grOk) { printf("Graphics error: %s\n", grapherrormsg(errorcode)); printf("Press any key to halt:"); getch(); exit(1); } } void closeDrv(void){ closegraph(); } int ctextx(int x1,int x2,char * str){ int x; x = ((x1 + x2) - strlen(str) * 8)/2; return x; } int ctexty(int y1,int y2){ int y; y = (y1 + y2 - 6) /2; return y; } void fillbox_3D(int x1,int y1,int x2,int y2){ setcolor(15); line(x1,y1,x2,y1); line(x1,y1+1,x2,y1+1); line(x1,y1,x1,y2); line(x1+1,y1,x1+1,y2); setcolor(8); line(x2,y1,x2,y2); line(x2-1,y1,x2-1,y2); line(x1,y2,x2,y2); line(x1,y2-1,x2,y2-1); setfillstyle(1,7); bar(x1+2,y1+2,x2-2,y2-2); } void fillbox_3D_Down(int x1,int y1,int x2,int y2,int c){ setcolor(8); line(x1,y1,x2,y1); line(x1,y1+1,x2,y1+1); line(x1,y1,x1,y2); line(x1+1,y1,x1+1,y2); setcolor(15); line(x2,y1,x2,y2); line(x2-1,y1,x2-1,y2); line(x1,y2,x2,y2); line(x1,y2-1,x2,y2-1); setfillstyle(1,c); bar(x1+2,y1+2,x2-2,y2-2); }

void fillbox_2D(int x1,int y1,int x2,int y2,int fallpat,int fallc,int lc){ setcolor(lc); line(x1,y1,x2,y1); line(x1,y1,x1,y2); line(x2,y1,x2,y2); line(x1,y2,x2,y2); setfillstyle(fallpat,fallc); bar(x1+1,y1+1,x2-1,y2-1); } void draw_win_3D(int x1,int y1,int x2,int y2,int tc,char * title,int wc){ fillbox_3D(x1,y1,x2,y2); setcolor(8); line(x1+3,y1+3,x2-3,y1+3); line(x1+3,y1+3,x1+3,y1+22); setcolor(15); line(x1+3,y1+22,x2-3,y1+22); line(x2-3,y1+3,x2-3,y1+22); setfillstyle(1,tc); bar(x1+4,y1+4,x2-4,y1+21); int x = ctextx(x1+3,x2-3,title); int y = ctexty(y1+3,y1+22); setcolor(wc); outtextxy(x,y,title); } void auto_line(int x1,int y1,int x2,int y2){ setcolor(8); line(x1,y1,x2,y2); setcolor(15); line(x1,y1+1,x2,y2+1); } void buttonUp(int x1,int y1,int x2,int y2,char * Caption){ setcolor(15); line(x1,y1,x2,y1); line(x1,y1,x1,y2); setcolor(8); line(x2,y1,x2,y2); line(x1,y2,x2,y2); setfillstyle(1,7); bar(x1+1,y1+1,x2-1,y2-1); int x = ctextx(x1,x2,Caption); int y = ctexty(y1,y2); setcolor(0); outtextxy(x,y,Caption); } void buttonDown(int x1,int y1,int x2,int y2,char * Caption){ setcolor(8); line(x1,y1,x2,y1); line(x1,y1,x1,y2); setcolor(15); line(x2,y1,x2,y2); line(x1,y2,x2,y2); setfillstyle(1,7); bar(x1+1,y1+1,x2-1,y2-1); int x = ctextx(x1,x2,Caption); int y = ctexty(y1,y2); setcolor(0); outtextxy(x,y,Caption); } void buttonselect(int x1,int y1,int x2,int y2,char * Caption){ setcolor(15); line(x1,y1,x2,y1); line(x1,y1,x1,y2); setcolor(8); line(x2,y1,x2,y2); line(x1,y2,x2,y2); int x = ctextx(x1,x2,Caption); int y = ctexty(y1,y2); setfillstyle(1,9); bar(x1 + 3,y1 + 3,x2 - 3,y2 - 3); setcolor(0); outtextxy(x,y,Caption); } void kill_words(int x1,int y1,int x2,int y2){ setfillstyle(1,7); bar(x1,y1,x2,y2); } int cwinx(int x){ int ox; ox = 640 - x; return ox; } int cwiny(int y){ int oy; oy = 480 - y; return oy; } void textbox(int x1,int y1,int x2,int y2,int bcolor,int wc,char * Caption){ fillbox_3D_Down(x1,y1,x2,y2,bcolor); setcolor(wc); int x = ctextx(x1,x2,Caption); int y = ctexty(y1,y2); outtextxy(x,y,Caption); } void ProgressBar(int x1,int y1,int x2,int y2,int bcolor,int c ,int value){ fillbox_3D_Down(x1,y1,x2,y2,bcolor); int howlong = (x2 - x1) / 100; setfillstyle(1,c); if(x1+3+howlong * value >= x2){ bar(x1+3,y1+3,x1-3+howlong * value,y2-3); } else{ bar(x1+3,y1+3,x1+3+howlong * value,y2-3); } } void copy(int x1,int y1,int x2,int y2,int c,char * file1, char * file2){ FILE * oldfile, * newfile; struct ffblk ffblk; long howlong = 0; long flag = 0; long bytes = 0; int b = 0; oldfile = fopen(file1,"rb"); newfile = fopen(file2,"wb"); int done = findfirst(file1,&ffblk,0); while(!done){ howlong = howlong + ffblk.ff_fsize; done = findnext(&ffblk); } bytes = howlong / 100; do { fputc(fgetc(oldfile),newfile); flag = flag + 1; if(flag / bytes == 1){ flag = 0; b = b + 1; ProgressBar(x1,y1,x2,y2,7,c,b); } }while(!feof(oldfile)); fclose(oldfile); fclose(newfile); }

搜索更多相关主题的帖子: 源代码 dos 初中 见笑 
2005-04-17 11:27
yuki
Rank: 2
等 级:新手上路
威 望:5
帖 子:508
专家分:0
注 册:2005-2-4
收藏
得分:0 

/* Setup.Cpp */ #include "app1.h"

void mainmenu(void); void findfile(char * fp); void text(int flag); void select(void); void helpmessage(void); void programemain(void); void quittodos(void); void fhd(void); void fnf(void); void searchDospath(void); void searchToolspath(void); void searchMyDospath(void); void wautoexec(void); void wconfig(void); void installDos(void); void installTools(void); void installMyDos(void); void enoughspace(void);

main(int argc,char * argv[]){ if(argc == 1){ initDrv(); programemain(); } else if(argc == 2 && !strcmp(argv[1],"/v")){ textmode(C80); textcolor(15|128); cprintf("BootDisk"); textcolor(9); cprintf(" Version"); textcolor(2|128); cprintf(" 2000 "); textcolor(9); cprintf("by GoodJob studio\n"); int y = wherey(); gotoxy(1,y); cprintf("Writer : Yu Sheng"); textmode(-1); exit(1); } else if(argc == 2 && !strcmp(argv[1],"/?")){ printf("BootDisk Version 2000.\n"); printf("/v To see the BootDisk Version\n"); printf("/fhd To format HardDisk\n"); printf("/id To install Dos\n"); printf("/it To install Tools\n"); printf("/imd To install MyDos\n"); printf("/? To see Quick Help"); } else if(argc == 2 && !strcmp(argv[1],"/fhd")){ fhd(); } else if(argc == 2 && !strcmp(argv[1],"/id")){ initDrv(); installDos(); } else if(argc == 2 && !strcmp(argv[1],"/it")){ initDrv(); installTools(); } else if(argc == 2 && !strcmp(argv[1],"/imd")){ initDrv(); installMyDos(); } else{ initDrv(); programemain(); } return 0; }

void mainmenu(void){ draw_win_3D(50,50,cwinx(50),cwiny(50),1,"BootDisk Version 2000 Install Menu",2); textbox(55,400,585,425,7,6,"Welcome to use BootDisk Version 2000"); setcolor(5); settextstyle(1,1,7); outtextxy(100,100,"BootDisk"); setcolor(4); settextstyle(5,0,5); outtextxy(265,75,"Selected Menu"); settextstyle(0,0,1); buttonselect(275,155,490,185,"Format HardDisk"); buttonUp(275,190,490,220,"Install Dos"); buttonUp(275,225,490,255,"Install Tools"); buttonUp(275,260,490,290,"Install My Dos"); buttonUp(275,295,490,325,"About BootDisk"); buttonUp(275,330,490,360,"Exit"); } void text(int flag){ if(flag == 1){ textbox(55,400,585,425,7,6,"To format your HardDisk"); } else if(flag == 2){ textbox(55,400,585,425,7,6,"To install Microsoft Dos 6.22"); } else if(flag == 3){ textbox(55,400,585,425,7,6,"To install some tools"); } else if(flag == 4){ textbox(55,400,585,425,7,6,"We develop some tools for MS-DOS"); } else if(flag == 5){ textbox(55,400,585,425,7,6,"To see BootDisk about information"); } else if(flag == 6){ textbox(55,400,585,425,7,6,"Exit to Dos"); } } void select(void){ int flag = 1; int key; char Redo = 'Y'; while(Redo == 'Y'){ Redo = 'N'; key = bioskey(0); switch(key){ case UPKEY: if(flag == 1){ buttonUp(275,155,490,185,"Format HardDisk"); buttonselect(275,330,490,360,"Exit"); flag = 6; Redo = 'Y';

} else if(flag == 2){ buttonUp(275,190,490,220,"Install Dos"); buttonselect(275,155,490,185,"Format HardDisk"); flag = 1; Redo = 'Y';

} else if(flag == 3){ buttonUp(275,225,490,255,"Install Tools"); buttonselect(275,190,490,220,"Install Dos"); flag = 2; Redo = 'Y';

} else if(flag == 4){ buttonUp(275,260,490,290,"Install My Dos"); buttonselect(275,225,490,255,"Install Tools"); flag = 3; Redo = 'Y';

} else if(flag == 5){ buttonUp(275,295,490,325,"About BootDisk"); buttonselect(275,260,490,290,"Install My Dos"); flag = 4; Redo = 'Y';

} else if(flag == 6){ buttonUp(275,330,490,360,"Exit"); buttonselect(275,295,490,325,"About BootDisk"); flag = 5; Redo = 'Y';

} text(flag); break; case DOWNKEY: if(flag == 1){ buttonUp(275,155,490,185,"Format HardDisk"); buttonselect(275,190,490,220,"Install Dos"); flag = 2; Redo = 'Y';

} else if(flag == 2){ buttonUp(275,190,490,220,"Install Dos"); buttonselect(275,225,490,255,"Install Tools"); flag = 3; Redo = 'Y';

} else if(flag == 3){ buttonUp(275,225,490,255,"Install Tools"); buttonselect(275,260,490,290,"Install My Dos"); flag = 4; Redo = 'Y';

} else if(flag == 4){ buttonUp(275,260,490,290,"Install My Dos"); buttonselect(275,295,490,325,"About BootDisk"); flag = 5; Redo = 'Y';

} else if(flag == 5){ buttonUp(275,295,490,325,"About BootDisk"); buttonselect(275,330,490,360,"Exit"); flag = 6; Redo = 'Y';

} else if(flag == 6){ buttonUp(275,330,490,360,"Exit"); buttonselect(275,155,490,185,"Format HardDisk"); flag = 1; Redo = 'Y';

} text(flag); break; case ENTER : if(flag == 6){ quittodos(); } else if(flag == 5){ buttonDown(275,295,490,325,"About BootDisk"); delay(150); buttonUp(275,295,490,325,"About BootDisk"); delay(150); helpmessage(); } else if(flag == 1){ buttonDown(275,155,490,185,"Format HardDisk"); delay(150); buttonUp(275,155,490,185,"Format HardDisk"); delay(150); fhd(); } else if(flag == 2){ buttonDown(275,190,490,220,"Install Dos"); delay(150); buttonUp(275,190,490,220,"Install Dos"); delay(150); installDos(); } else if(flag == 3){ buttonDown(275,225,490,255,"Install Tools"); delay(150); buttonUp(275,225,490,255,"Install Tools"); delay(150); installTools(); } else if(flag == 4){ buttonDown(275,260,490,290,"Install My Dos"); delay(150); buttonUp(275,260,490,290,"Install My Dos"); delay(150); installMyDos(); } break; case ESC : closegraph(); exit(1); break; case F1 : helpmessage(); break; default : Redo = 'Y'; } } } void quittodos(void){ buttonDown(275,330,490,360,"Exit"); delay(150); buttonUp(275,330,490,360,"Exit"); delay(150); closeDrv(); exit(1); } void findfile(char * fp){ FILE * file; if((file = fopen(fp,"rb")) == NULL){ draw_win_3D(200,160,450,315,1,"Error",4); setcolor(0); int x = ctextx(200,450,"Cannot find file"); int y = ctexty(160,315); outtextxy(x,y - 10,"Cannot find file"); setcolor(4); x = ctextx(200,450,fp); outtextxy(x,y,fp); auto_line(205,275,445,275); buttonselect(284,285,365,306,"Continue"); getch(); buttonDown(284,285,365,305,"Continue"); delay(150); buttonselect(284,285,365,306,"Continue"); delay(150); programemain(); } fclose(file); } void helpmessage(void){ draw_win_3D(200,160,450,315,1,"About BootDisk",2); setcolor(0); int x = ctextx(200,450,"BootDisk Version 2000"); outtextxy(x,200,"BootDisk Version 2000"); outtextxy(x,210," by GoodJob studio "); outtextxy(x,220," writer Yu Sheng "); setcolor(9); outtextxy(x-20,245,"Email Address:"); outtextxy(x+30,255,"goldyu@online.sh.cn"); auto_line(205,275,445,275); buttonselect(284,285,365,306,"Continue"); getch(); buttonDown(284,285,365,305,"Continue"); delay(150); buttonselect(284,285,365,306,"Continue"); delay(150); programemain(); } void programemain(void){ mainmenu(); select(); } void fnf(void){ draw_win_3D(200,160,450,315,1,"Error",4); setcolor(0); int x = ctextx(200,450,"Cannot find file format.com"); int y = ctexty(160,310); outtextxy(x,y,"Cannot find file format.com"); auto_line(205,275,445,275); buttonselect(284,285,365,306,"Continue"); getch(); buttonDown(284,285,365,305,"Continue"); delay(150); buttonselect(284,285,365,306,"Continue"); delay(150); programemain(); } void fhd(void){ FILE * fp; if((fp = fopen("Format.com","rb")) == NULL){ fnf(); } else{ closeDrv(); system("format c:/q/u/s/v:GoodJob"); initDrv(); programemain(); } fclose(fp); } void installDos(void){ draw_win_3D(150,140,500,315,1,"Install Dos",2); int x = ctextx(160,490,"Please wait a moment."); setcolor(0); outtextxy(x,180,"Please wait a moment"); x = ctextx(160,490,"it will updata your computer system"); outtextxy(x,195,"it will updata your computer system"); outtextxy(163,210,"After that,it will install MS-DOS on your"); outtextxy(163,225,"computer,it takes you only a few minutes."); setcolor(1); enoughspace(); searchDospath(); findfile("mscdex.exe"); x = ctextx(160,490,"Source File A:\\mscdex.exe"); outtextxy(x,240,"Source File A:\\mscdex.exe"); x = ctextx(160,490,"To C:\\dos\\mscdex.exe"); outtextxy(x,250,"To C:\\dos\\mscdex.exe"); copy(175,270,475,290,1,"mscdex.exe","c:\\dos\\mscdex.exe"); kill_words(170,240,480,260); setcolor(1); findfile("chkdsk.exe"); x = ctextx(160,490,"Source File A:\\chkdsk.exe"); outtextxy(x,240,"Source File A:\\chkdsk.exe"); x = ctextx(160,490,"To C:\\dos\\chkdsk.exe"); outtextxy(x,250,"To C:\\dos\\chkdsk.exe"); copy(175,270,475,290,1,"chkdsk.exe","c:\\dos\\chkdsk.exe"); kill_words(170,240,480,260); setcolor(1); findfile("cdrom.sys"); x = ctextx(160,490,"Source File A:\\cdrom.sys"); outtextxy(x,240,"Source File A:\\cdrom.sys"); x = ctextx(160,490,"To C:\\dos\\cdrom.sys"); outtextxy(x,250,"To C:\\dos\\cdrom.sys"); copy(175,270,475,290,1,"cdrom.sys","c:\\dos\\cdrom.sys"); kill_words(170,240,480,260); setcolor(1); findfile("fdisk.exe"); x = ctextx(160,490,"Source File A:\\fdisk.exe"); outtextxy(x,240,"Source File A:\\fdisk.exe"); x = ctextx(160,490,"To C:\\dos\\fdisk.exe"); outtextxy(x,250,"To C:\\dos\\fdisk.exe"); copy(175,270,475,290,1,"fdisk.exe","c:\\dos\\fdisk.exe"); kill_words(170,240,480,260); setcolor(1); findfile("format.com"); x = ctextx(160,490,"Source File A:\\format.com"); outtextxy(x,240,"Source File A:\\format.com"); x = ctextx(160,490,"To C:\\dos\\format.com"); outtextxy(x,250,"To C:\\dos\\format.com"); copy(175,270,475,290,1,"format.com","c:\\dos\\format.com"); kill_words(170,240,480,260); setcolor(1); findfile("smartdrv.exe"); x = ctextx(160,490,"Source File A:\\smartdrv.exe"); outtextxy(x,240,"Source File A:\\smartdrv.exe"); x = ctextx(160,490,"To C:\\dos\\smartdrv.exe"); outtextxy(x,250,"To C:\\dos\\smartdrv.exe"); copy(175,270,475,290,1,"smartdrv.exe","c:\\dos\\smartdrv.exe"); kill_words(170,240,480,260); setcolor(1); findfile("hdformat.exe"); x = ctextx(160,490,"Source File A:\\hdformat.exe"); outtextxy(x,240,"Source File A:\\hdformat.exe"); x = ctextx(160,490,"To C:\\dos\\hdformat.exe"); outtextxy(x,250,"To C:\\dos\\hdformat.exe"); copy(175,270,475,290,1,"hdformat.exe","c:\\dos\\hdformat.exe"); kill_words(170,240,480,260); setcolor(1); findfile("deltree.exe"); x = ctextx(160,490,"Source File A:\\deltree.exe"); outtextxy(x,240,"Source File A:\\deltree.exe"); x = ctextx(160,490,"To C:\\dos\\deltree.exe"); outtextxy(x,250,"To C:\\dos\\deltree.exe"); copy(175,270,475,290,1,"deltree.exe","c:\\dos\\deltree.exe"); kill_words(170,240,480,260); setcolor(1); findfile("himem.sys"); x = ctextx(160,490,"Source File A:\\himem.sys"); outtextxy(x,240,"Source File A:\\himem.sys"); x = ctextx(160,490,"To C:\\dos\\himem.sys"); outtextxy(x,250,"To C:\\dos\\himem.sys"); copy(175,270,475,290,1,"himem.sys","c:\\dos\\himem.sys"); kill_words(170,240,480,260); setcolor(1); findfile("sys.com"); x = ctextx(160,490,"Source File A:\\sys.com"); outtextxy(x,240,"Source File A:\\sys.com"); x = ctextx(160,490,"To C:\\dos\\sys.com"); outtextxy(x,250,"To C:\\dos\\sys.com"); copy(175,270,475,290,1,"sys.com","c:\\dos\\sys.com"); kill_words(170,240,480,260); setcolor(1); findfile("dos.exe"); x = ctextx(160,490,"Source File A:\\dos.exe"); outtextxy(x,240,"Source File A:\\dos.exe"); x = ctextx(160,490,"To C:\\dos\\dos.exe"); outtextxy(x,250,"To C:\\dos\\dos.exe"); copy(175,270,475,290,1,"dos.exe","c:\\dos\\dos.exe"); kill_words(170,240,480,260); setcolor(1); x = ctextx(160,490,"Decompression Files"); outtextxy(x,245,"Decompression Files"); system("c:"); system("cd\\dos"); system("dos > NUL"); unlink("dos.exe"); system("a:"); kill_words(170,240,480,260); setcolor(1); x = ctextx(160,490,"Write autoexec.bat"); outtextxy(x,245,"Write autoexec.bat"); wautoexec(); delay(250); kill_words(170,240,480,260); setcolor(1); x = ctextx(160,490,"Write config.sys"); outtextxy(x,245,"Write config.sys"); wconfig(); delay(250); programemain(); } void installTools(void){ draw_win_3D(150,140,500,315,1,"Install Dos",2); int x = ctextx(160,490,"Please wait a moment."); setcolor(0); outtextxy(x,180,"Please wait a moment"); x = ctextx(160,490,"it will updata your computer system"); outtextxy(x,195,"it will updata your computer system"); outtextxy(163,210,"After that,it will install Tools on your"); outtextxy(163,225,"computer,it takes you only a few minutes."); setcolor(1); enoughspace(); searchToolspath(); findfile("Tools.exe"); x = ctextx(160,490,"Source File A:\\Tools.exe"); outtextxy(x,240,"Source File A:\\Tools.exe"); x = ctextx(160,490,"To C:\\tools\\Tools.exe"); outtextxy(x,250,"To C:\\tools\\Tools.exe"); copy(175,270,475,290,1,"tools.exe","c:\\tools\\tools.exe"); kill_words(170,240,480,260); setcolor(1); x = ctextx(160,490,"Decompression Files"); outtextxy(x,245,"Decompression Files"); system("c:"); system("cd\\tools"); system("tools > NUL"); unlink("tools.exe"); system("a:"); programemain(); }


我们都在命运湖上荡舟划桨,波浪起伏使我们无法逃离孤行;如果我们迷失方向,波浪将指引我们穿过另一天曙光
2005-04-17 11:28
yuki
Rank: 2
等 级:新手上路
威 望:5
帖 子:508
专家分:0
注 册:2005-2-4
收藏
得分:0 
void installMyDos(void){
     draw_win_3D(150,140,500,315,1,"Install Dos",2);
     int x = ctextx(160,490,"Please wait a moment.");
     setcolor(0);
     outtextxy(x,180,"Please wait a moment");
     x = ctextx(160,490,"it will updata your computer system");
     outtextxy(x,195,"it will updata your computer system");
     outtextxy(163,210,"After that,it will install MyDos on your");
     outtextxy(163,225,"computer,it takes you only a few minutes.");
     setcolor(1);
     enoughspace();
     searchMyDospath();
     findfile("mydos.exe");
     x = ctextx(160,490,"Source File A:\\Mydos.exe");
     outtextxy(x,240,"Source File A:\\Mydos.exe");
     x = ctextx(160,490,"To C:\\mydos\\Mydos.exe");
     outtextxy(x,250,"To C:\\mydos\\Mydos.exe");
     copy(175,270,475,290,1,"mydos.exe","c:\\mydos\\mydos.exe");
     kill_words(170,240,480,260);
     setcolor(1);
     x = ctextx(160,490,"Decompression Files");
     outtextxy(x,245,"Decompression Files");
     system("c:");
     system("cd\\mydos");
     system("mydos &gt; NUL");
     unlink("mydos.exe");
     system("a:");
     programemain();
}
void searchDospath(void){
     char * p;
     system("c:");
     system("cd\\");
     p = searchpath("Dos");
     if(p == NULL){
 mkdir("c:\\dos");
 system("a:");
     }
     else{
 system("cd\\dos");
 struct ffblk ffblk;
 int done = findfirst("*.*",&amp;ffblk,0);
 while(!done){
      unlink(ffblk.ff_name);
      done = findnext(&amp;ffblk);
 }
 system("cd\\");
 system("a:");
     }
}
void searchToolspath(void){
     char * p;
     system("c:");
     system("cd\\");
     p = searchpath("Tools");
     if(p == NULL){
 mkdir("c:\\tools");
 system("a:");
     }
     else{
 system("cd\\tools");
 struct ffblk ffblk;
 int done = findfirst("*.*",&amp;ffblk,0);
 while(!done){
      unlink(ffblk.ff_name);
      done = findnext(&amp;ffblk);
 }
 system("cd\\");
 system("a:");
     }
}
void searchMyDospath(void){
     char * p;
     system("c:");
     system("cd\\");
     p = searchpath("MyDos");
     if(p == NULL){
 mkdir("c:\\mydos");
 system("a:");
     }
     else{
 system("cd\\mydos");
 struct ffblk ffblk;
 int done = findfirst("*.*",&amp;ffblk,0);
 while(!done){
      unlink(ffblk.ff_name);
      done = findnext(&amp;ffblk);
 }
 system("cd\\");
 system("a:");
     }
}
void enoughspace(void){
     struct dfree free;
     long avail;
     int drive;
     system("c:");
     drive = getdisk();
     getdfree(drive+1, &amp;free);
     if (free.df_sclus == 0xFFFF){
 draw_win_3D(200,160,450,315,1,"Error",4);
 setcolor(0);
 int x = ctextx(200,450,"Internal command error");
 int y = ctexty(160,310);
 outtextxy(x,y,"Internal command error");
 auto_line(205,275,445,275);
 buttonselect(284,285,365,306,"Continue");
 getch();
 buttonDown(284,285,365,305,"Continue");
 delay(150);
 buttonselect(284,285,365,306,"Continue");
 delay(150);
 system("a:");
 programemain();
     }
     avail =  (long) free.df_avail
      * (long) free.df_bsec
      * (long) free.df_sclus;
     struct ffblk ffblk;
     int done = findfirst("a:\\*.*",&amp;ffblk,0);
     long howlong = 0;
     while(!done){
   howlong = howlong + ffblk.ff_fsize;
   done = findnext(&amp;ffblk);
     }
     if(avail &lt; howlong){
 draw_win_3D(200,160,450,315,1,"Error",4);
 setcolor(0);
 int x = ctextx(200,450,"Not enough space");
 int y = ctexty(160,310);
 outtextxy(x,y,"Not enough space");
 auto_line(205,275,445,275);
 buttonselect(284,285,365,306,"Continue");
 getch();
 buttonDown(284,285,365,305,"Continue");
 delay(150);
 buttonselect(284,285,365,306,"Continue");
 delay(150);
 system("a:");
 programemain();
     }
     else{
 system("a:");
     }
}
void wautoexec(void){
     FILE * autoexec;
     autoexec = fopen("c:\\autoexec.bat","w+");
     fprintf(autoexec,"@ECHO OFF\n");
     fprintf(autoexec,"SET DIRCMD=/W/P/L/OD\n");
     fprintf(autoexec,"PATH C:\\DOS;C:\\TOOLS;C:\\MYDOS;C:\\ \n");
     fprintf(autoexec,"SET TEMP=C:\\TEMP\n");
     fprintf(autoexec,"LH C:\\DOS\\\n");
     fprintf(autoexec,"LH C:\\DOS\\MSCDEX.EXE /D:IDECD001 /V /M:1\n");
     fprintf(autoexec,"LH C:\\DOS\\SMARTDRV.EXE\n");
     fprintf(autoexec,"CLS");
     fclose(autoexec);
}
void wconfig(void){
     FILE * config;
     config = fopen("c:\\config.sys","w+");
     fprintf(config,"DOS=HIGH,UMB\n");
     fprintf(config,"STACKS=9,265\n");
     fprintf(config,"LASTDRIVE=F\n");
     fprintf(config,"FILES=40\n");
     fprintf(config,"BUFFERS=30,0\n");
     fprintf(config,"DEVICE=C:\\DOS\\HIMEM.SYS /TESTMEM:OFF /SHADOWRAM:ON\n");
     fprintf(config,"DEVICE=C:\\DOS\\EMM386.EXE NOEMS\n");
     fprintf(config,"DEVICEHIGH=C:\\DOS\\CDROM.SYS /D:IDECD001");
     fclose(config);
}

我们都在命运湖上荡舟划桨,波浪起伏使我们无法逃离孤行;如果我们迷失方向,波浪将指引我们穿过另一天曙光
2005-04-17 11:28
yuki
Rank: 2
等 级:新手上路
威 望:5
帖 子:508
专家分:0
注 册:2005-2-4
收藏
得分:0 
当时并不清楚结构和指针的概念,所以代码看上去比较繁琐。。。
但至今还是不太会使用结构,继续努力学习,高手见笑了。。。

我们都在命运湖上荡舟划桨,波浪起伏使我们无法逃离孤行;如果我们迷失方向,波浪将指引我们穿过另一天曙光
2005-04-17 11:30
yuki
Rank: 2
等 级:新手上路
威 望:5
帖 子:508
专家分:0
注 册:2005-2-4
收藏
得分:0 
嗯,真的是我初中时写的,确切的说是初三上半学期写的,而且是利用国庆长假,没有好好复习,用了一个星期写了这么个东西。。一些代码是参考TC3.0帮助手册中的(包括BIOS键盘控制和硬盘可用空间计算)。。其中MYDOS.exe是我写的一套模仿部分DOS工具的套件,哎,现在也不知道哪里去了,这份源代码也是我好不容易找出来的,从我大哥的电脑里挖出来的,本来要他帮我改改的,后来时间久了也都忘了,现在能够回来真的很开心。。。

我今年刚刚上大一,请多指教。。

我们都在命运湖上荡舟划桨,波浪起伏使我们无法逃离孤行;如果我们迷失方向,波浪将指引我们穿过另一天曙光
2005-04-23 22:43
yuki
Rank: 2
等 级:新手上路
威 望:5
帖 子:508
专家分:0
注 册:2005-2-4
收藏
得分:0 
其实里面没有很难理解的算法,自己看程序就知道了。。。
一个主要是画图形界面,我就说说如何画3D对话框吧。。画3D框之前我参考了当时win98的窗体,左边和上边两条线是高亮白色然后右下两条边是暗灰色,这样就构成了立体的感觉。。然后填充窗体,填充区域的确定,即窗体的大小减去边框占用的大小,然后设定好颜色,使用bar函数填充,这些函数我都参考了TC3.0帮助手册的用法。。一个地方我当时比较难的便是计算标题的位置,只要计算出标题所占用的长度,将窗体整个长度减去标题长度除以2就行了。。

还有一个自己觉得比较难的就是制作进程条,首先我把文件长度计算出来,因为进程条通常是以100%为极限,所以必须用将文件大小除以100计算出每1%所需要的字节,然后根据进程条的长度计算相应的填充区,不断的刷新填充区的大小,直到100%为止,这里其实有个计算错误的地方,在调试程序的时候发现进程条填充区域会溢出,所以我用了一个很不科学的方法去修正这个错误,即减去一些值。。。。我想以后C语言学得好点了再去修改吧。。。。

还有就是BIOS键盘的键值我是怎么得到的。我使用了TC3.0帮助中对于bioskey()函数提供的一个实例一个个将键测试出来,真的很笨不是吗?由于许多功能我能力有限无法全部用C实现,只好用System()函数执行DOS命令,呵呵,真的很傻,现在看来。。。。

我们都在命运湖上荡舟划桨,波浪起伏使我们无法逃离孤行;如果我们迷失方向,波浪将指引我们穿过另一天曙光
2005-04-23 23:05
yuki
Rank: 2
等 级:新手上路
威 望:5
帖 子:508
专家分:0
注 册:2005-2-4
收藏
得分:0 
以下是引用牛虻在2005-4-23 22:56:08的发言: 指教?不敢啊,你教我好了,我拜你为师哈.
拜我为师不敢当,我自己也只是三角猫功夫,不可以教人的。。。希望大家彼此帮助吧

我们都在命运湖上荡舟划桨,波浪起伏使我们无法逃离孤行;如果我们迷失方向,波浪将指引我们穿过另一天曙光
2005-04-23 23:19
yuki
Rank: 2
等 级:新手上路
威 望:5
帖 子:508
专家分:0
注 册:2005-2-4
收藏
得分:0 
我是上海的。。。

我们都在命运湖上荡舟划桨,波浪起伏使我们无法逃离孤行;如果我们迷失方向,波浪将指引我们穿过另一天曙光
2005-04-24 10:33
快速回复:念初中时编的dos 6.22启动盘源代码,现在好像不用了,把原码贴出来,高 ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.020495 second(s), 10 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved