There is an exe in system32 called edit.com . It is an old text editor. I'm wondering how they made a console app have a gui, and work with the mouse?开发者_StackOverflow社区 Thanks
There are no shortcuts.
The mouse had to be interfaced with through assembly code.
You would call interrupt 33 to have access to several functions like reading the mouse motion counters and button states. Then you'd read the CPU registers to get those numbers. From there on you could do everything else in C, including the GUI-like interface. There's no shortcut to that either - it must be manually done, each individual square has to be painted the correct color.
edit.com is REALLY old. It was written before the Windows GUI was really popular. They probably use special DOS functions to create the graphics and recognize the mouse.
Well prior to Windows 3.1 there used to be an operating system call DOS and I believe the mouse thing came with DOS 5.0 or DOS 4.0.
Your best bet for adding mouse and color support to a console is to use some kind of TextArea control and make your own console instead of using the DOS console. You could also look into ncurses for Windows but I don't recommend it. If you just want color you could also look at this tutorial.
精彩评论