当前位置: 代码迷 >> C语言 >> 看看这个程序能在VC下调式吗?
  详细解决方案

看看这个程序能在VC下调式吗?

热度:212   发布时间:2006-11-20 20:30:18.0
看看这个程序能在VC下调式吗?

用C也是莫明奇妙的发生错误。

搜索更多相关的解决方案: 调式  

----------------解决方案--------------------------------------------------------

具体一点


----------------解决方案--------------------------------------------------------
程序在哪里?
----------------解决方案--------------------------------------------------------

#include <graphics.h>
#include <stdio.h>
#include<conio.h>
#include<dos.h>
#include<stdlib.h>
#define NO 0
#define YES 1
#define NONE -1
#define MAX_MENU 7
int X,Y;
int Selection;
int button,x,y;
void *p;
size_t area;
struct MENU
{int x;
int y;
int x1;
int y1;
unsigned char Active[MAX_MENU];
char *head;
};
int MouseOn(struct MENU *t);
void Process();
void Xorbar(int sx,int sy,int ex,int ey,int c);
void Show();
void Hide();
void Status();
struct MENU File={200,110,250,130};
struct MENU Edit={295,110,345,130};
struct MENU Help={390,110,440,130};
struct MENU Close={600,10,620,30};
struct MENU Neeraj={380,300,460,315};

void main()
{
int gd,gm;
detectgraph(&gd,&gm);
initgraph(&gd,&gm,"");
Selection=NONE;
for(gd=0;gd<MAX_MENU;gd++)
{File.Active[gd]=YES;
Edit.Active[gd]=YES;
Help.Active[gd]=YES;
Close.Active[gd]=YES;
}
File.head="[File Menu]";
Edit.head="[Edit Menu]";
Help.head="[Help Menu]";
Close.head="[Exit]";
area=imagesize(0,0,150,150);
p=malloc(area);
if(p==NULL)
{closegraph();
restorecrtmode();
printf("Not Enough Memory !\n try to reduce the area used.\n");
exit(1);
}setfillstyle(1,7);
bar(0,0,640,480);
X=2;Y=2;
Process();
End();
closegraph();
printf("GUI-MENUS By Neeraj Sharma - n21@indiatimes.com\n");
getch();
}
void Process()
{char *fm[]={"New","Open","Save","Save as","Exit"};
char *em[]={"Undo","Cut","Copy","Paste","Delete","Select All"};
char *hm[]={"Help Topics","About Menus"};
char KEY;
Win(140,100,500,140);
DrawBtn(&File,"File");
DrawBtn(&Edit,"Edit");
DrawBtn(&Help,"Help");
settextstyle(0,0,0);
outtextxy(Close.x+7,Close.y+7,"x");
Comments();
Show();
File.Active[3]=NO;
Edit.Active[0]=NO;
while(1)
{
if(kbhit())
{KEY=getch();
if(KEY==27|| KEY==45)
break;
}
Status();
if(button==1)
{if(MouseOn(&Close))
break;
if(MouseOn(&File))
{PullMenuDown(fm,5,&File);
if(Selection==NONE)
Msg("No Selection !");
else
Msg(fm[Selection]);
if(Selection==4)
break;
}
if(MouseOn(&Edit))
{
PullMenuDown(em,6,&Edit);
if(Selection==NONE)
Msg("No Selection !");
else
Msg(em[Selection]);
}
if(MouseOn(&Help))
{
PullMenuDown(hm,2,&Help);
if(Selection==NONE)
Msg("No Selection !");
else
Msg(hm[Selection]);
if(Selection==1)
Msg("*Programming By NEERAJ SHARMA *");
}
}
else
{
if(MouseOn(&File)) Hlight(&File);
if(MouseOn(&Edit)) Hlight(&Edit);
if(MouseOn(&Help)) Hlight(&Help);
if(MouseOn(&Close)) Hlight(&Close);
if(MousseOn(&Neeraj))
{
Msg("Hello,everyone");
while(MouseOn(&Neeraj))
{
status();
if(button!=0) break;
if(kbhit()) break;
}
Msg(" ");
}
}
}
Msg(":: Bye Bye ::");
}

DrawBtn(struct MENU *tm,char *txt)
{setcolor(0);
settextstyle(2,0,4);
outtextxy(tm->x+15,tm->y+4,txt);
}

Hlight(struct MENU *t)
{

winp(t,0);
Msg(t->head);
while(MouseOn(t))
{
Status();
if(button!=0) break;
if(kbhit()) break;
}
setcolor(7);
Hide();
rectangle(t->x,t->y,t->x1,t->y1);
Msg(" ");
Show();
}


winp(struct MENU *t,int state)
{
Hide();
if(state==1)
{
setcolor(0);
line(t->x,t->y,t->x,t->y1);
line(t->x,t->y,t->x1,t->y);
setcolor(15);
line(t->x1,t->y,t->x1,t->y1);
line(t->x,t->y1,t->x1,t->y1);
}
else
{
setcolor(15);
line(t->x,t->y,t->x,t->y1);
line(t->x,t->y,t->x1,t->y);
setcolor(0);
line(t->x1,t->y,t->x1,t->y1);
line(t->x,t->y1,t->x1,t->y1);
}
Show();
}


Win(int sx,int sy,int ex,int ey)
{
Hide();
setfillstyle(1,7);
bar(sx,sy,ex,ey);
setcolor(15);
line(sx,sy,sx,ey);
line(sx,sy,ex,sy);
setcolor(0);
line(ex,sy,ex,ey);
line(sx,ey,ex,ey);
Show();
}

PullMenuDown(char *H[],int n,struct MENU *tm)
{
int i;
i=n*20;
Push(tm);
Hide();
getimage(tm->x+1,tm->y1+2,tm->x+100,tm->y1+i+5,p);
Win(tm->x+1,tm->y1+2,tm->x+100,tm->y1+i+5);
setcolor(0);
settextstyle(2,0,4);
for(i=0;i<n;i++)
{
if(!tm->Active[i])
{
setcolor(15);outtextxy(tm->x+15,tm->y1+9+i*20,H[i]);
setcolor(0);
outtextxy(tm->x+14,tm->y1+8+i*20,H[i]);
}
else
outtextxy(tm->x+14,tm->y1+8+i*20,H[i]);
}
Show();
while(button==1) Status();
HandleMenu(n,tm);
}

PullMenuUp(struct MENU *tm)
{
int i;
Hide();
putimage(tm->x+1,tm->y1+2,p,COPY_PUT);
Show();
Up(tm);
}


union REGS i,o;
struct SREGS ss;
void Show()
{i.x.ax=1;
int86(0x33,&i,&o);
}

void Hide()
{
i.x.ax=2;
int86(0x33,&i,&o);
}

void Status()
{
i.x.ax=3;
int86(0x33,&i,&o);
button=o.x.bx;
x=o.x.cx;
y=o.x.dx;
}





----------------解决方案--------------------------------------------------------

在VC下调试说没找到graphics.h这个头文件。
这是怎么回事


----------------解决方案--------------------------------------------------------
这个只有用TC才行,因为只有TC才有graphics.h这个库函数
----------------解决方案--------------------------------------------------------
vc不支持图形开发
看一下Windows程序设计吧
----------------解决方案--------------------------------------------------------
那你用的windows操作系统界面使用什么开发的。
----------------解决方案--------------------------------------------------------
  相关解决方案