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

我住包子山

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

[基礎]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: [基礎]Win32 Console Applications - Part 1. of 6 2006-07-20 22:40 Gohan

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

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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>
            久久激情视频久久| 欧美福利电影网| 在线一区二区日韩| 老司机精品视频一区二区三区| 亚洲视频在线观看一区| 欧美**人妖| 玖玖精品视频| 国产综合色一区二区三区| 在线亚洲一区| 亚洲一区在线免费观看| 欧美精品成人91久久久久久久| 美女黄色成人网| 国产在线拍偷自揄拍精品| 亚洲夜间福利| 亚洲欧美国产毛片在线| 欧美日韩一级黄| 99国产精品视频免费观看| 亚洲九九精品| 欧美日本国产在线| 日韩视频亚洲视频| 亚洲视频精选| 国产精品av免费在线观看| 亚洲免费成人av| 亚洲一区二区三区视频| 欧美性大战久久久久久久| 日韩亚洲欧美一区| 亚洲欧美日韩精品在线| 国产精品你懂的在线| 亚洲在线第一页| 久久精品一区蜜桃臀影院| 国内偷自视频区视频综合| 久久精品一区二区三区不卡| 蜜桃av噜噜一区| 91久久中文| 欧美激情亚洲激情| 这里是久久伊人| 欧美在线观看网址综合| 国模精品娜娜一二三区| 久久久在线视频| 亚洲区一区二| 宅男噜噜噜66一区二区| 国产精品久久久久久久久久免费| 亚洲网站在线看| 久久综合伊人77777麻豆| 在线不卡免费欧美| 欧美黄色片免费观看| 亚洲视频一二| 免费观看亚洲视频大全| 一本综合精品| 国产日韩专区在线| 欧美成人免费全部观看天天性色| 99精品视频一区| 久久精品视频在线看| 亚洲日本aⅴ片在线观看香蕉| 欧美日韩在线播放| 久久狠狠婷婷| 亚洲免费成人av| 久久在线精品| 亚洲在线视频| 亚洲第一精品久久忘忧草社区| 欧美久久视频| 久久久久久9| 中文在线资源观看网站视频免费不卡 | 亚洲一区二区三区色| 国产午夜精品一区理论片飘花| 嫩草影视亚洲| 亚洲一区二区三区视频播放| 欧美成人免费网站| 欧美专区中文字幕| 中文亚洲欧美| 亚洲国产日韩在线一区模特| 国产精品久久一区二区三区| 美日韩在线观看| 欧美在线视频播放| 亚洲视频大全| 亚洲欧洲日本国产| 美脚丝袜一区二区三区在线观看| 一区二区日韩| 亚洲国产欧美不卡在线观看| 国产欧美一区二区三区视频| 欧美日本精品在线| 蘑菇福利视频一区播放| 亚洲欧美一区二区在线观看| 亚洲精品国产无天堂网2021| 免费欧美在线视频| 久久久久国产精品厨房| 亚洲图片欧美午夜| 亚洲人妖在线| 伊甸园精品99久久久久久| 国产精品网站一区| 欧美视频日韩| 欧美日韩亚洲一区二区三区| 欧美成人精品h版在线观看| 久久人91精品久久久久久不卡| 午夜伦欧美伦电影理论片| 亚洲午夜小视频| 中文网丁香综合网| 一区二区三区蜜桃网| 亚洲精品影视| 亚洲精品孕妇| 99精品视频免费全部在线| 亚洲精品一区二区三区99| 亚洲黄色小视频| 亚洲国产午夜| 亚洲精选在线观看| 日韩天天综合| 亚洲小说欧美另类社区| 亚洲天堂av图片| 亚洲午夜一区二区| 亚洲欧美另类在线观看| 亚洲在线第一页| 久久av一区二区三区| 久久久久免费视频| 免费不卡视频| 欧美日韩视频一区二区三区| 欧美视频中文一区二区三区在线观看 | 一区二区高清视频| 亚洲专区在线视频| 欧美一级久久久久久久大片| 欧美在线视频观看| 久久综合一区二区| 欧美日韩精品国产| 国产精品va在线播放| 国产欧美日韩伦理| 在线播放中文一区| 日韩视频二区| 小黄鸭精品aⅴ导航网站入口| 欧美中文字幕在线播放| 麻豆av一区二区三区| 亚洲国产精品日韩| 亚洲天堂黄色| 久久久久久九九九九| 蜜桃视频一区| 国产精品美女一区二区| 激情视频亚洲| 亚洲视频免费在线观看| 久久精品国产综合精品| 亚洲第一伊人| 亚洲欧美精品在线| 你懂的视频一区二区| 国产精品xxxxx| 一区在线播放视频| 亚洲一区二区三区免费视频| 久久精品综合网| 亚洲人精品午夜在线观看| 午夜宅男欧美| 欧美日韩国产免费观看| 国内自拍视频一区二区三区| 亚洲免费观看高清完整版在线观看| 亚洲女人天堂av| 欧美国产精品久久| 午夜精品短视频| 欧美另类极品videosbest最新版本| 国产日韩高清一区二区三区在线| 亚洲精品视频免费观看| 久久精品国产精品亚洲| 亚洲乱码国产乱码精品精可以看| 欧美中文日韩| 国产精品ⅴa在线观看h| 亚洲人体影院| 毛片基地黄久久久久久天堂| 宅男在线国产精品| 欧美激情一二三区| 狠狠色狠狠色综合人人| 欧美亚洲一区二区三区| 亚洲精品久久久蜜桃| 美女脱光内衣内裤视频久久影院 | 亚洲日本免费电影| 国产精品极品美女粉嫩高清在线 | 国产精品高潮呻吟久久av无限 | 久久亚洲午夜电影| 国产伦精品一区二区三区高清 | 久久亚洲欧美国产精品乐播| 一二三区精品| 欧美区一区二| 亚洲激情亚洲| 欧美成人dvd在线视频| 欧美一区二区成人| 国产欧美一区二区精品婷婷| 亚洲性夜色噜噜噜7777| 亚洲精品乱码久久久久久| 老牛嫩草一区二区三区日本| 国产一二三精品| 久久精品男女| 午夜日韩激情| 欧美激情在线有限公司| 久久久噜噜噜久久久| 免费观看成人| 亚洲高清一二三区| 美女图片一区二区| 亚洲电影毛片| 欧美激情亚洲视频| 女仆av观看一区| 日韩午夜在线电影| 亚洲欧洲精品一区| 欧美日韩亚洲国产精品| 在线亚洲观看| 亚洲午夜一区| 国内久久精品| 亚洲国产精品www|