青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

我住包子山

this->blog.MoveTo("blog.baozishan.in")

[基礎(chǔ)]Win32 Console Applications - Part 1. of 6

Win32 Console Applications - Part 1.

Hello World

Okay, hands up, who here started out with something like this, possibly in another language, possibly on another OS, but whatever, with something like that. I'm willing to bet there are a good few people who can say "yes, that was me". You don't really want to see the source do you? Oh all right then.

#include <iostream>
using namespace std;

int main()
{
    cout << "Hello World!" << endl;
    return 0;
}

8 lines. Could be less, by why make things harder to read? This is really the great strength of a Windows Console Application, you really do not need to do much in order to make a working program. That is why I use consoles. If I want to test out a bit of non GUI code, and I don't have a suitable application I can use as a framework, I knock together a quick console application, and I'm sure just about every other Windows programmer does as well. The user interface only needs to be sophisticated enough to get the job done.

Some of the other tutorials on the site demostrate powerful techniques, but do it in a Console App because that's all that was needed.

Can you do anything else with a Console App? Of course, the answer is yes, you can, and these tutorials demostrate some of the things that can be done with a console. Believe it or not, a huge number of questions concerning consoles crop up in help forums every week, so people are interested. If you are, read on.

----------

What is a Console? It is a Window, a special kind, yes, but it is a Window. You will frequently hear these things called "DOS boxes" because DOS had a character based UI, but this term is incorrect. There is no DOS under the NT cored WIndows operating systems, (NT, 2000, XP), and yet you can use a console. Why? Because it is a Window. (There are actually DOS emulators for these platforms - but this is a totally unrelated topic.)

What makes a Console window special is that it is character based rather than pixel based. A normal window, like this browser window for example, (unless you're using a REALLY basic browser), is measured in pixels, each pixel is individually addressable and modifiable. With a character based medium, that is not the case, the smallest unit that can be addressed and thus modified is a character cell.

A console's display area consist of rows and columns of character cells. It is a grid or two dimensional array or matrix of cells, all these terms are in use - they amount ot the same thing. Traditionally, the character cell at the top left is the origin or "home" position, and is designated (0,0) in an imaginary (x,y) grid. The character cell to it's immediate right is (1,0), the next (2,0) and so on. The cell just below (0,0) is (0,1), the one below that (0,2) and so on. On a typical console there are 80 cell positions across the screen, and 25 down, thus on such a console, the bottom right cell will be (79,24) remembering the grid is zero based. The little picture below shows graphically the cell numbers of the upper left portion of a larger screen or the entire grid of a 4x4 console of course.

CellGrid

Incidently, the reason for chosing 80x25 is historical. In the days before graphical terminals were widely available, people used character based terminals called "Visual Display Units", or VDU's. These typically had an 80x25 screen layout. I was one of those who used these beasts.

----------

Each character cell can contain one and only one character. I'll illustrate an artifact of this below. I type 5 "w" characters, then on the line below, 5 "i" characters...

wwwww
iiiii

... notice the length of the lines. Assuming you are using a modern browser, you should see that the upper line is longer than the lower. Now I'll write a console app which does the same, here is the output...

FixedFont

... as you see, since each cell can only hold a single character, the last "i" character is directly below the last "w". There can be no proportional spacing in a console with the default font, (it is possible to simulate a very crude form of proportional spacing if only a few letters are used - but forget it - it's not worth the hassle).

Okay, so we've got a grid of cells, what is in a cell? Simply, a cell is another grid, each cell being 8 pixels wide and 12 high. The characters that make up the font must be represented within this grid including any spacing - that's right, the pixels of one cell lie directly adjacent to the pixels of the next. This is somewhat limiting, and accounts for the rather poor quality of the console font, but as we will see later, it does have some advantages. The pictures below show how the "w" and "i" characters are encoded into a cell.

w Grid i Grid

Notice the blank column on the right of the "w", this ensures that two adjacent "w" characters will have at least a single pixel space between them. If you look at the last picture, you will see that is the case. Also notice, the dot over the "i" does not go to the top of the cell, this ensures that any character on the line above an "i" that has a descender, an extension below the normal line, "y" for example, will still have at least a one pixel gap between the descender and a "high" character. Thus, normal characters are represented by 7x11 grids with a blank row at the top and a blank column on the right side.

The pixels marked with a "X" in the pictures above are rendered in the foreground colour, those in the empty pixels positions, in the background colour. By default, the foreground is white, the background black. Later on in the tutorial, I will show you how to change these colours, within limits.

----------

There is a one pixel wide gap around the outside edge of the consoles display area. This prevents the top, bottom and edge characters merging with the frame. You cannot write into this gap. Thus a console's display area is 2+(8x) pixels wide, where x is the number of character cells in a row, and 2+(12y) pixels high where y is the number of visible rows, (there may be more rows above or below the current view as determined by the position of the scroll bar).

I'm afraid this first page has really been rather a lot of dry theory. A lot of what you can do with consoles assumes you understand this material though, so read it through, and if later on in this tutorial, you find something that sounds weird, try reading this page again!

In the next part, I'll show you how to name your Console, obtain the consoles standard handles, move the cursor about, write blocks of characters and clear the screen.

posted on 2006-07-20 22:39 Gohan 閱讀(480) 評論(1)  編輯 收藏 引用 所屬分類: C++

Feedback

# re: [基礎(chǔ)]Win32 Console Applications - Part 1. of 6 2006-07-20 22:40 Gohan

來源于http://www.adrianxw.dk  回復(fù)  更多評論   

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            欧美一区二区在线| 亚洲一区二区三区四区五区黄| 一区二区日韩| 性亚洲最疯狂xxxx高清| 9国产精品视频| 欧美激情综合网| 日韩午夜激情| 亚洲黄色在线观看| 久久一日本道色综合久久| 国产精品入口夜色视频大尺度 | 亚洲国产精品视频一区| 久久婷婷色综合| 国产麻豆精品在线观看| 亚洲欧美日韩天堂| 亚洲一线二线三线久久久| 欧美成人精品激情在线观看 | 久久久久久久波多野高潮日日| 国产精品视频九色porn| 欧美一区二区三区在线视频| 亚洲一区二区三区在线播放| 国产精品一二三视频| 亚洲欧美综合另类中字| 亚洲一区二区三区中文字幕在线| 国产精品乱码久久久久久| 亚洲一级黄色片| 亚洲在线一区| 亚洲国产高清在线观看视频| 一本大道久久a久久精品综合| 国产一区二区无遮挡| 亚洲国产成人91精品| 国产精品日韩在线观看| 亚洲国产成人精品久久| 国产精品一区久久久久| 亚洲高清资源| 国产欧美在线看| 91久久精品一区二区别| 国内精品免费午夜毛片| 一区二区三区视频在线看| 在线不卡欧美| 校园春色综合网| 亚洲色图在线视频| 美女网站在线免费欧美精品| 西西人体一区二区| 欧美日韩视频免费播放| 欧美成人在线免费视频| 国产午夜亚洲精品理论片色戒| 亚洲高清精品中出| 一区二区在线观看av| 亚洲自拍电影| 亚洲视频图片小说| 欧美精品国产精品| 欧美xxx成人| 极品av少妇一区二区| 亚洲欧美日韩另类| 亚洲欧美一区二区精品久久久| 欧美精品日韩| 亚洲国产一区二区视频| 亚洲高清成人| 久久一综合视频| 久久亚洲精品一区| 国产主播一区二区三区四区| 亚洲主播在线观看| 先锋影音国产精品| 国产女优一区| 亚洲免费一区二区| 欧美在现视频| 国产欧美一区二区精品秋霞影院| 亚洲一区二区三区视频| 亚洲一区视频在线| 国产精品久久国产精麻豆99网站| 亚洲精品婷婷| 亚洲调教视频在线观看| 欧美丝袜一区二区| 亚洲香蕉伊综合在人在线视看| 亚洲小说欧美另类社区| 国产精品美女久久久| 亚洲综合大片69999| 欧美在线观看视频| 国产一区二区按摩在线观看| 久久精品成人一区二区三区| 美女久久一区| 91久久久久久| 欧美日韩三区四区| 午夜久久影院| 欧美成年人视频网站欧美| 亚洲日本中文字幕免费在线不卡| 欧美二区在线观看| 一区二区三区国产精华| 欧美在线三级| 亚洲国产精品t66y| 欧美视频一区二区| 午夜精品久久久久久久蜜桃app | 日韩视频一区二区| 国产精品男人爽免费视频1 | 亚洲国产毛片完整版| 亚洲视频高清| 国产午夜精品视频| 欧美成人黑人xx视频免费观看| 99视频精品在线| 久久一日本道色综合久久| 亚洲精品一区二区三区樱花| 国产精品久久久久久久久久妞妞| 久久精品一区二区三区不卡牛牛| 亚洲黄色免费电影| 欧美亚洲免费| 最新国产拍偷乱拍精品| 国产精品久久一卡二卡| 久久福利视频导航| 日韩视频二区| 久久久久久9999| 中国成人黄色视屏| 在线不卡中文字幕| 欧美三级第一页| 美日韩精品视频免费看| 亚洲免费综合| 亚洲精一区二区三区| 久久婷婷激情| 亚洲综合国产| 日韩性生活视频| 亚洲高清色综合| 国产视频在线观看一区二区三区| 欧美久久视频| 久久久综合网站| 小嫩嫩精品导航| 夜夜精品视频一区二区| 亚洲国产成人tv| 美国成人毛片| 欧美中文字幕在线观看| 亚洲一区二区av电影| 亚洲日本中文字幕| 亚洲国产另类精品专区 | 另类av一区二区| 翔田千里一区二区| 亚洲在线观看视频网站| 99在线视频精品| 亚洲精品视频一区| 亚洲国内欧美| 亚洲国产成人午夜在线一区| 久热精品视频在线观看| 久久久久网址| 久久久久.com| 久久久国产一区二区| 久久国产精品99久久久久久老狼 | 韩国亚洲精品| 狠狠操狠狠色综合网| 黄色成人av在线| 含羞草久久爱69一区| 国模精品一区二区三区色天香| 国产欧美日韩在线观看| 国产欧美一区二区色老头| 国产日本亚洲高清| 国产亚洲成精品久久| 国产在线拍偷自揄拍精品| 国产在线视频不卡二| 激情亚洲成人| 亚洲国产三级网| 99成人免费视频| 亚洲午夜未删减在线观看| 亚洲欧美激情在线视频| 欧美一级在线亚洲天堂| 久久久久青草大香线综合精品| 蜜桃久久精品一区二区| 欧美国产日韩在线| 亚洲美女av电影| 亚洲综合日韩在线| 欧美中文字幕在线观看| 美女在线一区二区| 欧美日韩一区二区在线| 国产乱肥老妇国产一区二| 国产一区二区三区奇米久涩| 亚洲国产精品久久久| 一本色道久久精品| 久久国产福利国产秒拍| 欧美高清在线精品一区| 一区二区三区视频在线播放| 性18欧美另类| 男人插女人欧美| 国产精品成人一区| 在线日本成人| 亚洲综合三区| 欧美高清在线视频| 亚洲欧美高清| 欧美激情1区| 国产农村妇女精品一二区| 亚洲黄色性网站| 欧美一区二区三区啪啪| 欧美黄色精品| 欧美专区在线播放| 欧美日韩一区二区在线观看| 在线观看日韩欧美| 亚洲制服少妇| 亚洲福利精品| 久久国产视频网| 欧美日韩专区| 91久久精品一区| 久久综合九色九九| 亚洲无玛一区| 欧美日韩国产精品自在自线| 亚洲大片在线| 久久爱www久久做|