i am writting program for digital calculator.and i have brought calculator image using graphics on outputscreenand i want to give dual interface of keyboard and mouse.how can i do that in graphics?
thank you in advance.

Recommended Answers

All 9 Replies

Look into the curses library, or some variation thereof.

Wait, is this a console (text) program or a Windows (GUI) program?


In either case, you will have to add "event listeners": code that checks for input from the keyboard and the mouse. If a button is pressed, add the appropriate digit into the current number or invoke the appropriate function. If a key is pressed, add the appropriate digit into the current number or invoke the appropriate function.

In a Win32 console program, you'll have to either use the Curses library or use GetConsoleInput after using SetConsoleMode to add mouse events to the input mask.

In a Win32 GUI program, you'll add OnClick and OnKeyDown events to your application, or if you are writing your own WindowProc, listen for WM_LBUTTONDOWN and WM_KEYDOWN messages.

This is all for Win32, you may have noticed. If you are using Linux or DOS let me know.

Good luck.

Really it is doing with int 21h in MS-DOS. I don't know how right now but if you want I'll review asap.

from where can i get information about Curses library and other function you have mentioned?
till now i don't know anything about that ,as i am new learner and this is not in our course book. please explain somewhat in detail.thank for your reply.

Wait, is this a console (text) program or a Windows (GUI) program?


In either case, you will have to add "event listeners": code that checks for input from the keyboard and the mouse. If a button is pressed, add the appropriate digit into the current number or invoke the appropriate function. If a key is pressed, add the appropriate digit into the current number or invoke the appropriate function.

In a Win32 console program, you'll have to either use the Curses library or use GetConsoleInput after using SetConsoleMode to add mouse events to the input mask.

In a Win32 GUI program, you'll add OnClick and OnKeyDown events to your application, or if you are writing your own WindowProc, listen for WM_LBUTTONDOWN and WM_KEYDOWN messages.

This is all for Win32, you may have noticed. If you are using Linux or DOS let me know.

Good luck.

from where can i get information about Curses library and other function you have mentioned?
till now i don't know anything about that ,as i am new learner and this is not in our course book. please explain somewhat in detail.thank for your reply.

I don't know if curses is what you want or not, because you didn't clarify your situation too well, but here it is: (there are tutorials at the bottom)

http://en.wikipedia.org/wiki/Curses_(programming_library)

If it isn't in your coursebook and wasn't mentioned by your professor, you probably are wasting time messing with it. Just stick to the assignment.

I was doing a goolge search on this and found that some have already come up with a dual ponter program for linux and windows that allows you to switch between pointers and control them with one mouse, and even a mouse with a quick switch button on the side that includes the software in the driver. I was hoping to find something that would allow me and another person to control the same computer with two mouses and two keyboards (with or without dual moniters).
I fully believe that this can happen and I admire the thoughts of those that put their effort into this sort of expansion on technology.
On my search i found many posts on various websites that call this sort of thing useless and say that it cannot be done, so if you want to accomplish this, ignore them and more power to you.
as a programmer, I would say research the connections and software on a dumb terminal to see how it gives another focus to one machine and design a program that runs a runtime environment something like a virtual machine on the taskbar. (some programs that do this are Serious Samurize and Deskspace. )

you would need to attach an actionlistener that reads which port the input is coming from when one of your multiple keyboards or mice is inputting any information, and create a server that can configure which port is which keyboard or mouse, and finally assign a keyboard and mouse with a pointer into a group and separate each group with an ability to have its own active window.
it might be a good idea to prevent a single window to be the active window for both focus groups.

sorry if i talk to much. i can talk more if you want me to but i gotta go now, so see you next time

I realy think it could be useful when gaming in fullscreen. Would allow to use the second desktop (monitor) without being forced to alt+tab :)

Could also be something useful if some 3d modeling apps did allow 2-mouses shapes binding but yearh.. probably doesnt exist at all XD

Yah, if such a thing ever exists i guess lots a people should like it :P

( i tried making music with some friend with 2 typing keyboards and it was crazy cool XD [both played notes from both keyboards were played simulatoussfullfuly-siouly simultanoussioussellefly.... sumiltustiounously (what a messed up word) on the same instrument XD )

yah it could also allow dual user on a single computer saving 800$ for a second PC XD

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.