{"id":24,"date":"2009-05-25T23:25:22","date_gmt":"2009-05-25T17:55:22","guid":{"rendered":"http:\/\/vikku.info\/codesnippets\/?p=24"},"modified":"2009-05-25T23:25:50","modified_gmt":"2009-05-25T17:55:50","slug":"double-click-event-in-ms-dos","status":"publish","type":"post","link":"http:\/\/vikku.info\/codesnippets\/c-language-msdos\/double-click-event-in-ms-dos\/","title":{"rendered":"double click event in ms-dos"},"content":{"rendered":"<p>This program displays the click event of the mouse in ms dos environment using Turbo C. If you double click on the screen then you will get the message that you have double clicked else none. I wrote this function to use it in the 640&#215;480 16 color graphics mode for a simple my computer program to which detects single click and double click on a file.<\/p>\n<p>If people know about interrupts, ports, scan codes and button states then it might be useful for them if they are trying to under stand the concept of low level input and output. Using this may help them understand the windows env better&#8230;<\/p>\n<p>and one more important point is i have used inline asm codes so &#8230; be ware&#8230;<br \/>\nhere i would like to say one thing and that is about the inportb macro&#8230; using this i mimicked a multiprocessing program&#8230; which displays the time and at the same time it can detect the mouse and keyboard like in windows&#8230; i can never forget this word because i have used it very extensively. <\/p>\n<p> anyway here is the code&#8230;<\/p>\n<p>Interrupt 33 deals with the mouse and sub function 0 and 1 are for initialize mouse and show mouse pointer respectively&#8230; one interesting function i have made among the others&#8230; yeeeehaaawww&#8230;<\/p>\n<pre lang=\"C\">\r\n#include<time.h>\r\n#include<stdio.h>\r\n#include<dos.h>\r\n\r\n\tchar butt;\r\n\tclock_t start;\r\n\r\nvoid main()\r\n{\r\n\tvoid mouse();\r\n\tvoid click();\r\n\r\n\tstart=clock();\r\n\r\n\t_AX=0;asm int 33h;\r\n\t_AX=1;asm int 33h;\r\n\r\n\twhile(inportb(0x60)!=1)\r\n\t{\r\n\t\tmouse();\r\n\t    if(butt)\r\n\t    {\r\n\t\tclick();\r\n\t\twhile(butt)mouse();\r\n\t    }\r\n\t}\r\n\r\n}\r\n\r\nvoid click()\r\n{\r\n\tfloat as;\r\n\tas=(float) start-clock();\r\n\r\n\tgotoxy(50,2);\r\n\r\n\tif(as>-6.&&as<0.)\r\n\t\tprintf(\"double click\");\r\n\telse\r\n\t\tprintf(\"            \");\r\n\tstart=clock();\r\n}\r\n\r\nvoid mouse()\r\n{\r\n\t_AX=3;asm int 33h;\r\n\tbutt=_BX;\r\n}\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This program displays the click event of the mouse in ms dos environment using Turbo C. If you double click on the screen then you will get the message that you have double clicked else none. I wrote this function to use it in the 640&#215;480 16 color graphics mode for a simple my computer [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[7],"tags":[],"_links":{"self":[{"href":"http:\/\/vikku.info\/codesnippets\/wp-json\/wp\/v2\/posts\/24"}],"collection":[{"href":"http:\/\/vikku.info\/codesnippets\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/vikku.info\/codesnippets\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/vikku.info\/codesnippets\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/vikku.info\/codesnippets\/wp-json\/wp\/v2\/comments?post=24"}],"version-history":[{"count":2,"href":"http:\/\/vikku.info\/codesnippets\/wp-json\/wp\/v2\/posts\/24\/revisions"}],"predecessor-version":[{"id":26,"href":"http:\/\/vikku.info\/codesnippets\/wp-json\/wp\/v2\/posts\/24\/revisions\/26"}],"wp:attachment":[{"href":"http:\/\/vikku.info\/codesnippets\/wp-json\/wp\/v2\/media?parent=24"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/vikku.info\/codesnippets\/wp-json\/wp\/v2\/categories?post=24"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/vikku.info\/codesnippets\/wp-json\/wp\/v2\/tags?post=24"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}