C++ Programming Blog

 
 
 
#include <conio.h>
#include<win_mous.cpp>// Needed for mouse & win functions
#define OK (x>=170 && x<=210 && y>=290 && y<=310)
#define CANCEL (x>=280 && x<=330 && y>=290 && y<=310)
#define PUSHME (x>=170 && x<=330 && y>=150 && y<=250)
int x,y,b;
void Press(int sx,int sy,int ex,int ey)
{
 hidemouse();
 Button(\"\",sx,sy,ex,ey,PUSH);
 showmouse();
 while(b==1)
 getmouse(&b,&x,&y);
 hidemouse();
 Button(\"\",sx,sy,ex,ey,UNPUSH);
 showmouse();
}
void main()
{
 G();
 setfillstyle(1,3);
 bar(0,0,640,480);
 Win(\"Windows 98\",100,100,430,370,1);
 Button(\"Ok\",170,290,210,310,DRAW);
 Button(\"Cancel\",280,290,330,310,DRAW);
 Button(\"Push Me\",170,150,330,250,DRAW);
 showmouse();
 while(!kbhit())
 {
 getmouse(&b,&x,&y);
 if(b==1)
 {
    if OK
    {
        Press(170,290,210,310);
        break;
    }
    if CANCEL
    {
        Press(280,290,330,310);
        break;
    }
    if PUSHME  Press(170,150,330,250);
 }
 }
 closegraph();
}

    Related Post:
  1. To parse a string using Operator Precedence parsing

  2. Program to find the day of a week of a given date from 15 october 1582 to end of universe using arrays

  3. Program that prints odd numbers, even numbers and the numbers that are divisible by 5 b/w 0 to 50

  4. Program to illustrate the difference between the use of strcomp, strcmpi and stricmp

  5. Program to illustrate the declaration , initialization and printing a constant variable

  6. Program that maintains library shop stock using link list

  7. Program to read a Non Linear Function, construct and display the Difference Table

  8. Program that reads an expression consisting of two non-negative integer and an operator. Determine if either integer or the result of the expres......

  9. Program using cout statement to display in single line

  10. Program to estimate the value of Third Derivative of the function at the given points from the given data using Central Difference Formula of Order 4

  11. Program to show the Urdu Alphabets using Matrix Method

  12. Program to illusrate data conversion user defined data types using constructor

  13. Program to estimate value of First Derivative of the function at the given points from the given data using Backward Difference Formula , Forward diff

  14. Program to find largest integer among the three and display it using function with no return type

  15. Program to create vector

  16. Program to estimate the Differential value of a given function using Trapezoidal Rule [Predictor-Corrector Scheme (PC2)]

  17. Program of swapping numbers using pointers

  18. Program to illustrate the role of destructor in classes

  19. Program that reads a number ,coumputes and displays its factorial using do-while loop

  20. Program to convert a Postfix Expression into an Infix Expression

 
 
Didn't find what you were looking for? Find more on Program of simple windows & buttons