473,513 Members | 2,576 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

keyboard using C

1 New Member
whats wrong with this??

plz help me!!ASAP...
Expand|Select|Wrap|Line Numbers
  1. #include  <graphics.h>
  2. #include <stdlib.h>
  3. #include <stdio.h>
  4. #include <conio.h>
  5. #include <dos.h>
  6.  
  7. union REGS wregs;
  8. //char ascii,scan;   //Declared the global variables.
  9. int x,y,x1,y2;
  10. int main(void)
  11.  
  12.  
  13. {
  14.  
  15. /* request auto detection */
  16. int gdriver = DETECT, gmode, errorcode;
  17. int midx, midy;
  18. int stangle = 45, endangle = 135;
  19. int radius = 100;
  20.  
  21.  
  22. /* initialze graphics and local variables */
  23. initgraph(&gdriver, &gmode, "");
  24.  
  25. /* read result of initialization */
  26. errorcode = graphresult();
  27. /* an error occurred */
  28. if (errorcode != grOk)
  29. {
  30. printf("Graphics error: %s\n", grapherrormsg(errorcode));
  31. printf("Press any key to halt:");
  32. getch();
  33.  
  34. exit(1);     /* terminate with an error code */
  35. }
  36.  
  37. midx = getmaxx() /2;
  38. midy = getmaxy() /2;
  39.  
  40.  
  41. //  rectangle(500,50,550,60);
  42.  
  43. setcolor (LIGHTGRAY);
  44. rectangle(510,60,80,130);
  45. setfillstyle(1,WHITE);
  46. bar3d(10, 25, 625, 260, 4, 4);
  47. setfillstyle(1,DARKGRAY);
  48. bar3d(10,60,30,80,4,4);//esc key
  49. bar3d(340,100,390,120,4,4);//backspace key
  50. setcolor(DARKGRAY);
  51. for (x=10;x<330;x+=25)
  52. {
  53. setfillstyle(1,LIGHTGRAY);
  54. bar3d(x,100,x+20,120,4,4);} //num keys
  55. for (x=70;x<170;x+=25)
  56. {
  57. bar3d(x,60,x+20,80,4,4);}     // first 4 pair
  58. for (x=180; x<265;x+=25)
  59. {
  60.  
  61. setfillstyle(1,DARKGRAY);
  62. bar3d(x,60,x+20,80,4,4);}    //second 4 pair
  63. for(x=290;x<390;x+=25)
  64. {
  65.  
  66. setfillstyle(1, LIGHTGRAY);
  67. bar3d(x,60,x+20,80,4,4)}   // third 5 pair
  68. for(x=415;x<480;x+=25)
  69. {
  70. setfillstyle(1, DARKGRAY);
  71. bar3d(x, 60,x+20,80,4);}  // fourth 3 pairs
  72. for(x=55;x<350;x+=25)
  73. {
  74. setfillstyle(1, LIGTHGRAY);
  75. bar3d(x,130,x+20,150,4,4);} // q,w,e,r,t,y,u,i,o,p,[,]
  76. setfillstyle(1,DARKGRAY);
  77. bar3d(360,130,390,175,4,4);// enter key
  78. bar3d(345,160,390,185,4,0);//cont. enter key
  79. setfillstyle(1,DARKGRAY);
  80. bar3d(10, 130,45,150,4,4); // tab key
  81. bar3d(10,160,55,185,4,4); // capslock
  82. for(x=65;x<335;x+=25)
  83. {
  84.  
  85. setfillstyle(1,LIGHTGRAY);
  86. bar3d(x,160,x+20,180,4,4);} //asdfghjkl;: "
  87. setfillstyle(1,DARKGRAY);
  88. bar3d(10,190,65,210,4,4"); //left shift key
  89. for(x=70;x<320;x+=25)
  90. {
  91. setfillstyle(1,LIGHTGRAY);
  92. bar3d(x,190,x+20,210,4,4);} //zxcvbnm,./
  93. setfillstyle(1,DARKGRAY);
  94. bar3d(320,190,360,210,4,4);  //right shift key
  95. bar3d(365,190,390,210,4,4); //|\
  96. bar3d(10,220,45,240,4,4); // left ctrl key
  97. bar3d(50,220,65,240,4,4);// left blank key
  98. bar3d(70,220,100,240,4,4);// alt left key
  99. setfillstyle(1,LIGHTGRAY);
  100. bar3d(105,220,295,240,4,4); // space bar
  101. setfillstyle(1,DARKGRAY);
  102. bar3d(300,220,330,240,4,4); // alt right key
  103. bar3d(335,220,350,240,4,4); // right blank key
  104. bar3d(335,220,390,240,4,4); // right ctrl key
  105. for(x=415;x<480;x+=25)
  106. {
  107. setfillstyle(1,DARKGRAY);
  108. bar3d(x,100,x+20,120,4,4);} // insert, home, page up
  109. for(x=415;x<480;x+=25)
  110. {
  111. setfillstyle(1, DARKGRAY);
  112. bar3d(x,130,x+20,150,4,4) ; } // del, end, page down
  113. bar3d(440,190,460, 210,4,4); // up key
  114. for(x=415;x<480;x+=25)
  115. {
  116. setfillstyle(1,DARKGRAY);
  117. bar3d(x,220,x+20,240,4,4); }// left, down, right arrow keys
  118. for(x=510;x<570;x+=25)
  119. {
  120. bar3d(x,100,x+20,120,4,4); }// left first row keys
  121. for(x=510;x<570;x+=25)
  122. {
  123. setfillstyle(1, LIGHTGRAY);
  124. bar3d(x,130,x+20,150,4,4);} // 7,8,9
  125. for(x=510;x<570;x+=25)
  126. {
  127. bar3d(x,160,x+20,180,4,4); } // 4,5,6
  128. for(x=510;x<570;x+=25)
  129. {
  130. bar3d(x,190,x+20,210,4,4); } // 1,2,3,
  131. setfillstyle(1,DARKGRAY);
  132. bar3d(585,130,605,180,4,4) ; // + key
  133. bar3d(510,220,555,240,4,4) ; // 0 ins
  134. bar3d(560,220,580,240,4,4) ;// del
  135. setfillstyle(1, DARKGRAY);
  136. bar3d(585,190,605,240,4,4) ;// enter key
  137.  
  138. /* printing of letter keyboard */
  139. setcolor(BLACK);
  140. settextstyle(SMALL_FONT, HORIZ_DIR,4);
  141. outtextxy(11, 62, "Esc");
  142. outtextxy(75, 62, "F1");
  143. outtextxy(98, 62, "F2");
  144. outtextxy(125, 62, "F3");
  145. outtextxy(148, 62, "F4");
  146. outtextxy(183, 62, "F5");
  147. outtextxy(208, 62, "F6");
  148. outtextxy(233, 62, "F7");
  149. outtextxy(258, 62, "F8");
  150. outtextxy(293, 62, "F9");
  151. outtextxy(315, 62, "F10");
  152. outtextxy(343, 62, "F11");
  153. outtextxy(368, 62, "F12");
  154. settextstyle(SMALL_FONT, HORIZ_DIR,3);
  155. outtextxy(420,68, "Scr");
  156. settextstyle(2,0,2);
  157. outtextxy(445, 62, "Scl");
  158. outtextxy(443, 68, "Lock");
  159. outtextxy(469, 65, "Pase");
  160.  
  161. rectangle(515, 60, 613, 80);
  162. bar(516, 62, 546, 78);
  163. settextstyle(2, 0, 3);
  164. rectangle(524, 65, 520, 62);
  165. setfillstyle(1,LIGHTGREEN);
  166. bar(524, 65, 520, 63);
  167.  
  168. // rectangle (590, 65, 520, 62);
  169. outtextxy(518, 65, "Num");
  170. outtextxy(518, 70, "Lock");
  171. setfillstyle(1, DARKGRAY);
  172. bar(548,62,577,78);
  173. setfillstyle(1, LIGHTGREEN);
  174. bar(558, 65 , 5554, 63);
  175. outtextxy(558, 65 , "Caps");
  176. setfillstyle(1, DARKGRAY);
  177. outtextxy(552, 70, "Lock");
  178. bar(579, 62, 611, 78);
  179. outtextxy(582, 65, "Scroll");
  180. outtextxy(582, 70, "Lock");
  181. settextstyle(SMALL_FONT, HORIZ_DIR,4);
  182. outtextxy(20, 101, "~");
  183. outtextxy(16, 109, "`");
  184. outtextxy(40, 101, "!");
  185. outtextxy(40, 109, "1");
  186. outtextxy(65, 101, "@");
  187. outtextxy(65, 109, "2");
  188. outtextxy(90, 101, "#");
  189. outtextxy(90, 109, "3");
  190. outtextxy(115, 101, "$");
  191. outtextxy(115, 109, "4");
  192. outtextxy(139, 101, "%");
  193. outtextxy(139, 109, "5");
  194. outtextxy(165, 101, "^");
  195. outtextxy(165, 109, "6");
  196. outtextxy(190, 101, "&");
  197. outtextxy(190, 109, "7");
  198. outtextxy(215, 101, "*");
  199. outtextxy(215, 109, "8");
  200. outtextxy(240, 101, "(");
  201. outtextxy(240, 109, "9");
  202. outtextxy(265, 101, ")");
  203. outtextxy(265, 109, "0");
  204. outtextxy(290, 98, "_");
  205. outtextxy(290, 109, "-");
  206. outtextxy(315, 101, "+");
  207. outtextxy(315, 109, "=");
  208. settextstyle(2, 0 , 4);
  209. outtextxy(348, 101, "Back");
  210. outtextxy(348, 109, "space");
  211. settextstyle(2, 0 ,3)
  212. outtextxy(418, 105, "Ins");
  213. outtextxy(443, 105, "Home");
  214. outtextxy(468, 101, "Page");
  215. settextxy(468,109, "UP");
  216. settextstyle(2, 0 ,3);
  217. outtextxy(513, 101, "Num");
  218. outtextxy(513, 109, "Lock");
  219. settextstyle(2, 0 ,4);
  220. outtextxy(540, 101, "/");
  221. outtextxy(565, 101, "*");
  222. outtextxy(590, 101, "_");
  223. settextstyle(2, 0 ,5);
  224. outtextxy(18, 133, "Tab");
  225. outtextxy(60, 133, "Q");
  226. outtextxy(85, 133, "W");
  227. outtextxy(110, 133, "E");
  228. outtextxy(135, 133, "R");
  229. outtextxy(160, 133, "T");
  230. outtextxy(185, 133, "Y");
  231. outtextxy(210, 133, "U");
  232. outtextxy(235, 133, "I");
  233. outtextxy(260, 133, "O");
  234. outtextxy(286, 133, "P");
  235. settextstyle(2, 0 ,4);
  236. outtextxy(310, 130, "{");
  237. outtextxy(310, 138, "[");
  238. outtextxy(334, 130, "}");
  239. outtextxy(334, 138, "]");
  240. outtextxy(418, 133, "DeL");
  241. outtextxy(442, 133, "End");
  242. settextstyle(2, 0 ,3);
  243. outtextxy(468, 130, "Page");
  244. outtextxy(468, 140, "Down");
  245. settextstyle(2, 0 ,4);
  246. outtextxy(515, 130, "7");
  247. outtextxy(515, 138, "Hm");
  248. outtextxy(540, 130, "8");
  249. outtextxy(565, 130, "9");
  250. settextstyle(2, 0 ,3);
  251. outtextxy(564, 140, "PgUp");
  252. outtextxy(15, 168, "caps Lock");
  253. settextstyle(2, 0 ,5);
  254. outtextxy(70, 160, "A");
  255. outtextxy(95, 160, "S");
  256. outtextxy(120, 160, "D");
  257. outtextxy(145, 160, "F");
  258. outtextxy(170, 160, "G");
  259. outtextxy(196, 160, "H");
  260. outtextxy(208, 160, "J");
  261. outtextxy(243, 160, "K");
  262. outtextxy(270, 160, "L");
  263. outtextxy(295, 160, ":");
  264. outtextxy(295, 157, ";");
  265. outtextxy(318, 166, """);
  266. outtextxy(318, 168, "'");
  267. outtextxy(350, 160, "Enter");
  268. settextstyle(2, 0 ,4);
  269. outtextxy(513, 160, "4");
  270. outtextxy(540, 160, "5");
  271. outtextxy(564, 160, "6");
  272. settextstyle(2, 0 ,6);
  273. outtextxy(589, 146, "+");
  274. settextstyle(2, 0 ,4);
  275. outtextxy(23, 193, "Shift");
  276. settextstyle(2, 0 ,5);
  277. outtextxy(75, 191, "Z");
  278. outtextxy(100, 191, "X");
  279. outtextxy(125, 191, "C");
  280. outtextxy(149, 191, "V");
  281. outtextxy(178, 191, "B");
  282. outtextxy(199, 191, "N");
  283. outtextxy(225, 191, "M");
  284. settextstyle(2, 0 ,4);
  285. outtextxy(248, 191, "<");
  286. outtextxy(248, 197, ",");
  287. outtextxy(275, 191, ">");
  288. outtextxy(275, 197, ".");
  289. outtextxy(299, 191, "?");
  290. outtextxy(299, 198, "/");
  291. outtextxy(325, 195, "Shift");
  292. settextstyle(2, 0 ,5);
  293. outtextxy(373, 191, "|");
  294. outtextxy(450, 191, "\");
  295. settextstyle(2, 0 ,4);
  296. outtextxy(514, 191, "1");
  297. outtextxy(539, 191, "2");
  298. outtextxy(564, 191, "3");
  299. outtextxy(590, 191, "E");
  300. outtextxy(590, 199, "N");
  301. outtextxy(590, 208, "T");
  302. outtextxy(590, 216, "E");
  303. outtextxy(590, 225, "R");
  304. outtextxy(17, 225, "Ctrl");
  305. outtextxy(74, 225, "Alt");
  306. outtextxy(304, 225, "Alt");
  307. outtextxy(360, 225, "Ctrl");
  308. outtextxy(418, 225, "<-");
  309. outtextxy(442, 225, "");
  310. outtextxy(468, 225, "->");
  311. outtextxy(514, 220, "0");
  312. outtextxy(514, 230, "Ins");
  313. outtextxy(564, 220, ".");
  314. settextstyle(2, 0 ,5);
  315.  
  316. outtextxy(120, 223, "S P A C E    B A R");
  317. //outtextxy(200, 225);
  318.  
  319. settextstyle(2, 0 ,3);
  320. outtextxy(514, 200, "End");
  321. outtextxy(563, 200, "PgDn");
  322. outtextxy(564, 230, "DeL");
  323.  
  324.  
  325.  
  326. getch();
  327.  
  328.  
  329. closegraph();
  330. return 0;
  331. }
Dec 15 '07 #1
1 1662
sicarie
4,677 Recognized Expert Moderator Specialist
whats wrong with this??
Well, I was going to ask what IDE you were using, but as you can see - using code tags here would have actually saved you the time it took someone to reply. It pays to read the Posting Guidelines.
Dec 15 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
19092
by: dreamer | last post by:
I am making a program for a friend with a disability. I need to adjust his audio volume using the keyboard as he cannot use a mouse. Any suggestions as to how I can raise the volume using the up arrow on the keyboard and decrease the volume using the down arrow? I am using VB 5. Many thanks in advance.
30
2278
by: ajsiegel | last post by:
Arthur wrote: >> And either intuitively, or consciously, he is doing something that >> offsets it from something truly intergrated into the core of the >> language. By breakling all of his own rules. >But it *isn't* part of the core language. I think that's the whole >point. @decorator does something that no other statement in Python does,...
0
5760
by: George Hartas | last post by:
I am using Visual C# .NET 2003 to make a ComboBox accept both mouse and keyboard selection. For mouse selection code, I double-clicked ComboBox to get the default "comboBox1_SelectedIndexChanged" event. This code (see below) by itself works as expected with a mouse. But when using keyboard arrows to navigate the ComboBox drop- down, the...
6
12982
by: daFritz | last post by:
Hi! I need to prevent Task-Switching in my App, so I tried to implement a low level keyboard hook in a extra class. But it seems that the Parameters are not passed correctly to my Hook function. Similar Examples in VB .NET work correctly. Heres the Source Code: using System; using System.Runtime.InteropServices;
7
10602
by: Don Riesbeck Jr. | last post by:
I'm working on an application (OEM) using C# that utilizes input from a keyboard, and USB Barcode Scanner. The scanner is a HID Keyboard device, and input from it is sent to the system as if it were a keyboard. I need to be able to identify input from the scanner and keyboard independently. I've looked at DirectX.DirectInput, and using...
0
6623
by: rs | last post by:
Hi guys, I am trying to read from a USB keyboard using vb.net and HID classes. the USB keyboard is not my primary keyboard. I have a ps2 keyboard connected and is detected in device manager as my keyboard. the USB keyboard is detected as HID keyboard device. the program finds the keyboard if it is attached. and I am getting valid handles....
2
8740
by: rs | last post by:
Hi guys, I am trying to read from a USB keyboard using vb.net and HID classes. the USB keyboard is not my primary keyboard. I have a ps2 keyboard connected and is detected in device manager as my keyboard. the USB keyboard is detected as HID keyboard device. the program finds the keyboard if it is attached. and I am getting valid handles....
7
26517
by: jpierson | last post by:
Hi, I am tryin to create a keyboard hook that sends the keystroke ctrl + pause/break. I haven't used keyboard hooks before so I'm not too sure how to use them public int MyKeyboardProc(int nCode, int wParam, int lParam) {
6
17834
by: Steve Barnett | last post by:
Is there a .Net equivalent of the GetKeyboardState api? I need to know whether the user is pressing the Ctrl or Shift keys when they click on my usercontrol. Thanks Steve
331
14679
by: Xah Lee | last post by:
http://xahlee.org/emacs/modernization.html ] The Modernization of Emacs ---------------------------------------- THE PROBLEM Emacs is a great editor. It is perhaps the most powerful and most versatile text editor. And, besides text editing, it also serves as a
0
7270
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7178
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7128
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7543
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5704
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5103
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3255
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3242
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1612
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.