日本免费精品_最新日韩一区_亚洲视频一区在线_a在线视频观看_天天射夜夜骑_粉嫩av一区二区三区_欧美中日韩免费视频_综合图区欧美_国内精品美女在线观看_午夜精品久久久久久久男人的天堂

首頁 > 學院 > 開發設計 > 正文

iczelion tut6

2019-09-10 09:07:11
字體:
來源:轉載
供稿:網友

Theory:

Since normally there's only one keyboard in each PC, all running Windows programs must share it between them. Windows is responsible for sending the key strokes to the window which has the input focus.
Although there may be several windows on the screen, only one of them has the input focus. The window which has input focus is the only one which can receive key strokes. You can differentiate the window which has input focus from other windows by looking at the title bar. The title bar of the window which has input focus is highlighted.
Actually, there are two main types of keyboard messages, depending on your view of the keyboard. You can view a keyboard as a collection of keys. In this case, if you press a key, Windows sends a WM_KEYDOWN message to the window which has input focus, notifying that a key is pressed. When you release the key, Windows sends a WM_KEYUP message. You treat a key as a button. Another way to look at the keyboard is that it's a character input device. When you press "a" key, Windows sends a WM_CHAR message to the window which has input focus, telling it that the user sends "a" character to it. In fact, Windows sends WM_KEYDOWN and WM_KEYUP messages to the window which has input focus and those messages will be translated to WM_CHAR messages by TranslateMessage call. The window procedure may decide to process all three messages or only the messages it's interested in. Most of the time, you can ignore WM_KEYDOWN and WM_KEYUP since TranslateMessage function call in the message loop translate WM_KEYDOWN and WM_KEYUP messages to WM_CHAR messages. We will focus on WM_CHAR in this tutorial.
 

Example:

.386
.model flat,stdcall
option casemap:none

WinMain proto :DWORD,:DWORD,:DWORD,:DWORD include masm32includewindows.inc
include masm32includeuser32.inc
include masm32includekernel32.inc
include masm32includegdi32.inc
includelib masm32libuser32.lib
includelib masm32libkernel32.lib
includelib masm32libgdi32.lib .data
ClassName db "SimpleWinClass",0
AppName  db "Our First Window",0
char WPARAM 20h/t/t/t ; the character the program receives from keyboard .data?
hInstance HINSTANCE ?
CommandLine LPSTR ? .code
start:
   invoke GetModuleHandle, NULL
   mov    hInstance,eax
   invoke GetCommandLine
   mov CommandLine,eax

   invoke WinMain, hInstance,NULL,CommandLine, SW_SHOWDEFAULT
   invoke ExitProcess,eax WinMain proc hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:DWORD
   LOCAL wc:WNDCLASSEX
   LOCAL msg:MSG
   LOCAL hwnd:HWND
   mov   wc.cbSize,SIZEOF WNDCLASSEX
   mov   wc.style, CS_HREDRAW or CS_VREDRAW
   mov   wc.lpfnWndProc, OFFSET WndProc
   mov   wc.cbClsExtra,NULL
   mov   wc.cbWndExtra,NULL
   push  hInst
   pop   wc.hInstance
   mov   wc.hbrBackground,COLOR_WINDOW+1
   mov   wc.lpszMenuName,NULL
   mov   wc.lpszClassName,OFFSET ClassName
   invoke LoadIcon,NULL,IDI_APPLICATION
   mov   wc.hIcon,eax
   mov   wc.hIconSm,eax
   invoke LoadCursor,NULL,IDC_ARROW
   mov   wc.hCursor,eax
   invoke RegisterClassEx, addr wc
   invoke CreateWindowEx,NULL,ADDR ClassName,ADDR AppName,
/t   WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,
/t   CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,NULL,NULL,
/t   hInst,NULL
   mov   hwnd,eax
   invoke ShowWindow, hwnd,SW_SHOWNORMAL
   invoke UpdateWindow, hwnd
   .WHILE TRUE
/t        invoke GetMessage, ADDR msg,NULL,0,0
/t        .BREAK .IF (!eax)
/t        invoke TranslateMessage, ADDR msg
/t        invoke DispatchMessage, ADDR msg
       .ENDW
   mov     eax,msg.wParam
   ret
WinMain endp WndProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
   LOCAL hdc:HDC
   LOCAL ps:PAINTSTRUCT    .IF uMsg==WM_DESTROY
       invoke PostQuitMessage,NULL
   .ELSEIF uMsg==WM_CHAR
       push wParam
       pop  char
       invoke InvalidateRect, hWnd,NULL,TRUE
   .ELSEIF uMsg==WM_PAINT
       invoke BeginPaint,hWnd, ADDR ps
       mov    hdc,eax
       invoke TextOut,hdc,0,0,ADDR char,1
       invoke EndPaint,hWnd, ADDR ps
   .ELSE
       invoke DefWindowProc,hWnd,uMsg,wParam,lParam
       ret
   .ENDIF
   xor    eax,eax
   ret
WndProc endp
end start
 

Analysis:


char WPARAM 20h/t/t/t ; the character the program receives from keyboard This is the variable that will store the character received from the keyboard. Since the character is sent in WPARAM of the window procedure, we define the variable as type WPARAM for simplicity. The initial value is 20h or the space since when our window refreshes its client area the first time, there is no character input. So we want to display space instead.    .ELSEIF uMsg==WM_CHAR
       push wParam
       pop  char
       invoke InvalidateRect, hWnd,NULL,TRUE This is added in the window procedure to handle the WM_CHAR message. It just puts the character into the variable named "char" and then calls InvalidateRect. InvalidateRect makes the specified rectangle in the client area invalid which forces Windows to send WM_PAINT message to the window procedure. Its syntax is as follows: InvalidateRect proto hWnd:HWND,
/t/t/t/t lpRect:DWORD,
/t/t/t/t bErase:DWORD lpRect is a pointer to the rectagle in the client area that we want to declare invalid. If this parameter is null, the entire client area will be marked as invalid.
bErase is a flag telling Windows if it needs to erase the background. If this flag is TRUE, then Windows will erase the backgroud of the invalid rectangle when BeginPaint is called. So the strategy we used here is that: we store all necessary information relating to painting the client area and generate WM_PAINT message to paint the client area. Of course, the codes in WM_PAINT section must know beforehand what's expected of them. This seems a roundabout way of doing things but it's the way of Windows.
Actually we can paint the client area during processing WM_CHAR message by calling GetDC and ReleaseDC pair. There is no problem there. But the fun begins when our window needs to repaint its client area. Since the codes that paint the character are in WM_CHAR section, the window procedure will not be able to repaint our character in the client area. So the bottom line is: put all necessary data and codes that do painting in WM_PAINT. You can send WM_PAINT message from anywhere in your code anytime you want to repaint the client area.        invoke TextOut,hdc,0,0,ADDR char,1 When InvalidateRect is called, it sends a WM_PAINT message back to the window procedure. So the codes in WM_PAINT section is called. It calls BeginPaint as usual to get the handle to device context and then call TextOut which draws our character in the client area at x=0, y=0. When you run the program and press any key, you will see that character echo in the upper left corner of the client window. And when the window is minimized and maximized again, the character is still there since all the codes and data essential to repaint are all gathered in WM_PAINT section.

 

上一篇:iczelion tut4

下一篇:小程序

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

亚洲福利精品| av一区在线| 一区二区三区四区五区视频在线观看| 精品日韩av一区二区| 日本亚洲视频在线| 精品激情国产视频| 免费视频最近日韩| 欧美日韩综合视频网址| 国产午夜在线观看| 一区二区高清在线| 亚洲福利在线视频| 精品日本视频| 国产亚洲视频中文字幕视频| 精品免费视频| 日韩精品在线免费播放| 欧美日韩国产在线观看| 99久久久精品免费观看国产| 日本不卡免费高清视频| 国产乱码在线观看| 欧美亚洲专区| 日韩欧美高清在线视频| 国产123在线| 免费视频一区三区| 国产亚洲欧美色| 在线视频你懂得一区| 日韩精品首页| 欧美日韩国产综合视频在线观看中文| 欧美日韩激情一区二区三区| 欧美亚洲免费高清在线观看| 在线国产1区| 日韩欧美综合在线视频| 日韩欧美中文在线视频| 亚洲国产欧美日韩精品| 91极品视频在线观看| 日本国产一区| wwww亚洲| 精品中文字幕视频| 精品对白一区国产伦| 欧美日韩国产第一页| 在线日韩欧美| 麻豆精品视频入口| 久久久91精品国产| 69免费视频| 国产一级久久久| 一区二区三区精品久久久| 亚洲国产午夜精品| 欧美日韩高清一区二区不卡| 一区二区三区视频网站| 亚洲一区在线观看免费| 99久久婷婷| 免费看黄资源大全高清| 日本亚洲欧美三级| 国产日韩成人精品| 久久综合久久综合九色| 99pao成人国产永久免费视频| 日韩在线视频网| 一区二区在线观| 一级日韩一级欧美| 日韩欧美中文在线视频| 国产一级片播放| 日韩高清在线一区二区| 91精品视频在线| 日韩在线观看a| 亚洲中文字幕一区| 国产对白在线| 国产一级片网站| 日韩欧美中文字幕公布| 亚洲欧洲日韩精品在线| 精品国产99| 欧美成人vr18sexvr| 久久精品女人| 亚洲制服丝袜一区| 国产成人精品亚洲| 日韩国产成人精品| 亚洲成av人片在线| 午夜精品一区二区三区视频免费看| 日韩中文字幕在线一区| 精品视频999| 久久精品一二三| 中文字幕在线播出| 日韩精品视频免费| 欧美一级欧美三级在线观看| www.狠狠干| 中文在线一区| 免费国产h视频在线观看86| 日本啊v在线| 91久久精品国产| aa国产成人| 91精品国产乱码久久蜜臀| www.三级.com| 国产午夜精品一区二区三区视频| www.狠狠干| 久久久精品国产99久久精品芒果| 日本国产在线视频| 精品视频www| 亚洲图片小说综合| 精品欧美日韩在线| 国产成人精品三级| 日韩免费看网站| 区日韩二区欧美三区| 天天综合日日夜夜精品| 97久久精品| 国产欧亚日韩视频| 中文字幕亚洲欧美| av免费看在线| 免费在线播放av| 亚洲乱码中文字幕综合| 黄色欧美日韩| 一区二区精品| 日韩欧美国产高清| 精品一区二区三区中文字幕| 中文字幕第一页在线| 中文 欧美 日韩| 久久精品黄色片| 91精品国产99| 日韩不卡一二区| 日本国产在线视频| 久久精品日韩无码| 国产对白在线| 中文字幕国产欧美| 久久久精品网| 欧美日韩亚洲国产综合| 一区二区三区久久| 欧美区高清在线| 亚洲一二三不卡| 日韩.com| 亚洲免费中文字幕| 亚洲高清视频一区| 国产视频1区| 日本va欧美va精品发布| 日韩午夜中文字幕| 欧美日韩成人综合| 伊人中文字幕在线观看| 日韩免费精品| 久久精品久久精品国产大片| 欧美三级网址| 狠狠色综合色区| 日韩免费视频一区| 日韩国产亚洲欧美| 亚亚洲欧洲精品| 日韩免费视频一区| 日韩欧美不卡在线| 中文在线日韩| h片精品在线观看| 91精品国产自产在线丝袜啪| 日韩久久不卡| 国产一区在线观看视频| 亚洲免费在线观看av| 精品视频1区2区3区| 久久精品日韩无码| 国产99精品| 欧美在线亚洲一区| 欧美一级搡bbbb搡bbbb| 亚洲综合视频一区| 精品国产乱码一区二区| 精品激情国产视频| 92久久精品| 久久91精品国产91久久小草 | 欧美日韩精品区| 日本啊v在线| 日韩欧美中文在线视频| 日韩你懂的电影在线观看| 日韩一级在线视频| 国产婷婷色一区二区三区在线| 国产一级在线免费观看| 中文在线不卡| 国产精品视频福利一区二区| 国产欧美日韩在线观看| 欧美二三四区| 日韩精品丝袜在线| 日韩中文字幕在线视频播放| 在线视频1区2区| 中文字幕精品在线视频| 欧美日韩在线播放三区四区| 久久福利视频一区二区| 日韩欧美久久| 日韩欧美一级精品久久| 亚洲免费中文字幕| 日韩一级在线免费观看| 中文字幕五月天| 精品激情国产视频| 欧美日韩一级视频| 国产欧美三级| 中文在线视频观看| 欧美日韩高清| 亚洲va韩国va欧美va精品| 一区三区二区视频| 国产欧美日韩在线观看| 日本a口亚洲| 黄污视频在线看| 视频一区视频二区中文| 国产又粗又猛又爽又黄91精品| 中文字幕中文字幕精品| 中文字幕日韩视频| 精品久久在线观看| 日韩在线a电影| 欧美日韩久久久| www.三级.com| 日韩欧美国产免费播放| 午夜一区二区视频| 国产资源在线观看入口av| 久久精品电影| 欧美日韩高清不卡| 国产福利免费在线观看| 日韩精品乱码av一区二区| 欧美日韩国产综合视频在线观看| 日韩欧美中文视频| 精品视频123区在线观看| 欧美国产日韩在线播放| 欧美99久久| 日本黄色一区二区三区| 日韩欧美中文字幕精品| 天天摸日日摸狠狠添| 日韩精品在线视频观看| 国产永久免费高清在线观看| 日韩午夜黄色| 欧美乱大交xxxxx免费| 国产成人综合av| 欧美日韩在线三级| 午夜私人影院在线观看| 91精品国产手机| 久久人人88| 拍真实国产伦偷精品| 国产欧美三级| 91精品国产日韩91久久久久久| 国产亚洲视频中文字幕视频| 国产一区在线不卡| 中文字幕亚洲乱码| 欧美日韩高清在线一区| 国产999在线观看| 国产黄色精品| 91精品在线观看国产| 亚洲国产无线乱码在线观看| 91精品国产91综合久久蜜臀| 午夜一区二区三区免费| 国产绿帽一区二区三区| 99在线精品视频免费观看20| 国产欧美日韩精品在线观看| 精品激情国产视频| 中文在线第一页| h片精品在线观看| 日本xxxwww免费视频| 日韩在线视频一区二区三区| 国产999精品在线观看| 亚洲国产欧美日韩精品| 一区二区三区免费看视频 | 日韩免费视频一区二区视频在线观看| 亚洲成av人片在线| 91精品国产手机| 欧美日韩国产一二三| 欧美日韩国产综合久久| 7799精品视频天天看| 91精品国产调教在线观看| 午夜亚洲一区| 一区二区三区中文字幕在线观看| 欧美色欧美亚洲高清在线视频| 不卡一区二区三区视频| 99久久精品国产亚洲| 日韩欧美中文在线视频| 国产在线观看91| 日韩综合精品| 欧美日韩精品欧美日韩精品| 99这里有精品视频| 九一精品国产| 欧美日韩中文字幕在线视频| www中文字幕在线观看| 亚洲一区在线观看视频| 国产三级视频网站| 国产色综合网| 国产欧美日韩不卡免费| 久久视频免费看| 亚洲乱码中文字幕综合| 在线一区二区三区精品| 欧美日韩高清一区二区| 日韩在线一区二区视频| 中文在线不卡视频| а√天堂中文在线资源8| 国产欧美日韩亚洲| 欧美久久一二三四区| 国产视频一区三区| 日韩视频一区| 亚洲一区资源| 欧美 日韩 国产 高清| 亚洲精品欧美二区三区中文字幕| 日韩在线观看一区| 国产中文在线| 中文字幕乱码在线| 欧美亚洲天堂网| 99精品视频国产| 久久精品夜夜夜夜久久| 久久视频一区| 1区2区在线| 久久人人88| 亚洲久草视频| 中文字幕在线看精品乱码| wwwav在线播放| 国产日韩中文在线| 国产成人精品av久久| 精品激情国产视频| 欧美日韩国产黄色| 亚洲热在线观看| 日韩激情一区| 中文字幕在线观看亚洲| 在线欧美日韩精品| 国产又粗又猛又爽又黄91精品| 中文字幕人成乱码在线观看| 日韩国产成人| 日韩区欧美区| 欧美日韩亚洲天堂| 精品免费久久久| 国产福利免费观看| 视频一区二区中文字幕| 国产999精品在线观看| 色综合天天性综合| 99久久精品国产亚洲| 国产视频1区| 国产婷婷一区二区| 欧美日韩在线精品一区二区三区激情综| 国产91久久久久蜜臀青青天草二 | 日韩av二区| 国产网站欧美日韩免费精品在线观看 | 麻豆精品99| 久久久精品欧美| 久久69成人| 欧美中文字幕第一页| 国产福利免费在线观看| 国产欧美一级| 人妻一区二区三区免费| 日本中文字幕在线观看| 精品国产免费视频| 中文字幕在线观看精品| 中文字幕日韩视频| 国产一级免费在线观看| 亚洲综合在线视频| 99国产成 人 综合 亚洲欧美 | 欧美三级日韩在线| 99视频精品全国免费| www.久久草| 久久综合久久综合九色| 国产一区成人| 中文字幕在线国产| 五月综合激情日本mⅴ| 999精品网| 国产一区高清视频| 午夜视频在线观看一区| 一区二区中文字幕在线| 精品视频1区2区3区| av三级在线播放| 亚洲免费在线观看av| 欧美日韩在线不卡视频| aaa欧美日韩| 一区三区二区视频| 日韩欧美在线字幕| 国产久卡久卡久卡久卡视频精品| 红桃视频亚洲| 免费高清特黄a大片| 国产 欧美 在线| 日韩中文字幕视频在线| 日韩中文字幕在线视频播放| 欧美激情一区二区三区在线| 亚洲九九精品| 国产久卡久卡久卡久卡视频精品| 国精品产品一区| 999精品色在线播放| 国产成人va亚洲电影| 欧美特黄一区| 欧美日韩国产区| 亚洲高清在线观看一区| 国产乱国产乱老熟300部视频| 欧美久久在线观看| 日本不卡免费高清视频| 日韩 欧美 综合| 伊人永久在线| 精品国产1区二区| 91精品国产综合久久精品| 日韩在线观看a| 樱花草www在线观看| 在线看欧美日韩| 日本精品二区| 日韩欧美三级| 日韩欧美一级在线| 不卡在线一区二区| 亚洲高清视频一区| av三级在线观看| 亚洲二区自拍| 精品日韩视频| 欧美一级在线免费| 不卡一区2区| 日韩中文在线视频| 深夜福利亚洲| 久久99精品久久久久子伦| 激情国产在线| 国产在线不卡av| 91精品久久久久久久久久入口| 国产一级在线免费观看| 日韩免费电影网站| xxxxx性| 国产综合精品在线| 日韩av一区二区在线观看| 亚洲福利精品视频|