home *** CD-ROM | disk | FTP | other *** search
- // Example: 087 from Library Reference
- #include "..\3D-Ware\dddware.h"
- #include <stdio.h>
- short num_buttons, button_var;
- short main(void)
- {
- dddInitKeybd(); // Initialise the keyboard reading functions.
- dddInitMouse(); // Initialise the mouse drivers.
- while (dddkeycode!=_ESC) // Loop until ESCape key is pressed.
- {
- button_var = dddMouseGetButtons(); // Read the status of the mouse buttons.
- if ((button_var & 1)!=0) // If bit 0 is set then left mouse button is pressed.
- {
- printf("Your LEFT mouse button is pressed.\tPress ESC to quit.\n");
- }
- if ((button_var & 2)!=0) // If bit 1 is set then right mouse button is pressed.
- {
- printf("Your RIGHT mouse button is pressed.\tPress ESC to quit.\n");
- }
- if (button_var ==0) // If no buttons are pressed then inform the user.
- {
- printf("NO buttons are pressed.\tPress ESC to quit.\n");
- }
- }
- dddRestoreKeybd(); // Restore the dos keyboard routines.
- return 0; // Bye.
- }
-