亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb

首頁 > 學(xué)院 > 開發(fā)設(shè)計(jì) > 正文

iczelion tut6

2019-09-10 09:07:11
字體:
供稿:網(wǎng)友

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

下一篇:小程序

發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表

圖片精選

亚洲一区二区网站| 亚洲理论电影片| 日韩美女爱爱视频| 欧美人与性动交α欧美精品| 顶级嫩模精品视频在线看| 国产91久久久| 久久精品一区二区三区不卡| 国产特级毛片| 欧美变态xxxx| 国产精品高颜值在线观看| 精品久久久三级丝袜| av在线首页| 亚洲视频一区二区在线| 伊人情人网综合| 免费一级特黄3大片视频| 欧美极品xxxx| 精品黑人一区二区三区国语馆| 浓精h攵女乱爱av| 国产一区二区三区高清在线观看| 国产免费av一区二区| 国产精品综合一区二区三区| 99riav1国产精品视频| 日韩国产欧美精品在线| 少妇一级淫免费观看| 91成人综合网| 亚洲一区不卡在线| 欧美精品一区二区三区很污很色的| 久久精品国产亚洲av麻豆色欲| 亚洲成人激情自拍| 国产区视频在线播放| 天天免费综合色| 在线免费观看毛片| 国产精品免费视频一区一| av片在线免费| 国产精品高清一区二区| 成人午夜视频免费看| www.日韩一区| 久久久一本精品99久久精品66| 日本电影在线观看网站| 欧洲精品中文字幕| 亚洲精品不卡在线| 国产日韩欧美视频在线观看| 亚洲 欧美 日韩在线| 国产精品美女久久久久久久| 国产伦精品一区二区免费| 精品九九久久| 欧美日韩精品综合| 国产91色在线|免| 草民午夜欧美限制a级福利片| 2019中文字幕在线观看| 精品xxxxxbbbb欧美中文| 国产中文字幕一区| 中文字幕字幕中文在线中不卡视频| 伊人青青综合网| 国产精品成人免费一区二区视频| 日韩av综合在线| 久久无码精品丰满人妻| 精品全国在线一区二区| 成人性生活免费看| 在线中文字幕播放| 日本三级片在线观看| 欧美黄色大片网站| 影音先锋中文在线视频| 国产日韩欧美精品综合| 国产精品国产三级国产普通话99| 国产精品狠色婷| 日本视频一区在线观看| 亚洲欧洲在线观看av| 久久尤物视频| 亚洲免费av网| 欧美老肥婆性猛交视频| 成人国产精品免费观看视频| 向日葵污视频在线观看| 欧美aaa级片| 婷婷综合在线| 91在线一区二区三区| 蜜桃视频在线网站| 女人另类性混交zo| 被男人吃奶添下面好舒服动态图| 成人黄色免费网址| 国产亚洲成人一区| 亚洲日本成人| 日本黄视频网站| 久久国内精品一国内精品| 国产日韩精品视频一区二区三区| 久久久国产精品免费| 久久精品无码一区二区三区毛片| 国产精品美女一区二区三区| 高清日韩av| 欧美xxxxhdvideosex| 日韩在线观看免费网站| 欧美日韩亚洲在线| 日韩人妻无码一区二区三区| 亚洲永久免费网站| 国产大陆a不卡| 亚洲va久久久噜噜噜久久天堂| 欧美日韩一区二区在线观看视频| 精品动漫一区| 欧美成人高清在线| 免费一区二区在线观看| 久久99精品一区二区三区| 香蕉久久aⅴ一区二区三区| 精品成人一区二区三区免费视频| 国产精品视频中文字幕| 成人三级小说| 亚洲国产岛国毛片在线| 偷拍女澡堂一区二区三区| 国产又爽又黄又舒服又刺激视频| a视频v在线| 色噜噜在线网| 97cao在线| 亚洲精品午夜级久久久久| 91网站视频在线观看| 性欧美亚洲xxxx乳在线观看| 最后生还者第二季在线观看| 欧美黄色激情视频| 日韩av电影在线免费播放| 国产精品一区在线播放| 黄色工厂在线观看| 能在线看的av| 成人开心激情| 欧美gay男男猛男无套| 黄色在线免费观看大全| 欧美一级淫片免费视频魅影视频| 99久久综合网| 欧美wwwxxxx| 91免费国产视频| 欧美激情在线狂野欧美精品| 欧美日韩视频免费在线观看| 亚洲精品视频在线播放| 91精品国产综合久久蜜臀| 国产视频一区二区三| av综合网址| 91在线公开视频| av不卡在线播放| 国产精品91久久久| 国产日韩欧美在线观看| 男人揉女人奶房视频60分| 成人免费高清视频在线观看| 99久久国产综合精品女小说| 久久综合图区亚洲综合图区| 写真福利精品福利在线观看| 国产精品成人品| 中文字幕日韩欧美精品高清在线| 欧美激情一区二区三区在线视频| 精品国精品国产自在久不卡| 91丝袜国产在线播放| 婷婷亚洲久悠悠色悠在线播放| 久久国产这里只有精品| 中文字幕欧美一区二区| 国产男人搡女人免费视频| 久久av红桃一区二区禁漫| 国产精品videossex撒尿| 成人精品在线观看| 99久久人妻无码中文字幕系列| 8x8x最新地址| www.av视频在线观看| 国产精品老牛影院在线观看| 羞羞色午夜精品一区二区三区| 日av中文字幕| 无码人妻一区二区三区免费| 国产精品一二三区视频| 日韩精品一区二区三区高清免费| 自拍亚洲欧美老师丝袜| 亚洲第一黄色网| 国产精品自拍三区| av手机免费观看| 亚洲高清资源| 久久久精品影院| 日韩欧美久久久| 国产在线精品一区在线观看麻豆| 18岁以下禁止观看的美女视频| 最近中文字幕一区二区三区| 男女男精品视频| 亚洲风情亚aⅴ在线发布| 国产在线青青草| 91嫩草|国产丨精品入口| 精品自拍偷拍| 中文字幕+乱码+中文乱码91| 视频一区二区三区四区五区| 六月丁香婷婷色狠狠久久| 欧美日韩一区二区国产| 开心丁香婷婷深爱五月| 欧美a级片视频| 日韩av不卡一区二区| 天天做天天摸天天爽天天爱| 国产精品18| 一二三区在线播放| 国产精品欧美激情在线播放| 久久99久久久久久| 色综合电影网| 欧美黑人巨大精品一区二区| 国内精品国产成人国产三级| 国产黄色精品| 国产精品久久久久久麻豆一区软件| 国产精品热久久久久夜色精品三区| 日韩影片中文字幕| 黄色资源在线观看| 高清不卡一区二区在线| 99蜜月精品久久91| 中出福利视频| 99久久人妻精品免费二区| 51精品国产| 国产精品久久久久久久久动漫| 精品一成人岛国片在线观看| 国产精久久一区二区三区| 国产精品久久久高清免费| 午夜精品视频在线| 91精品国产91久久综合桃花| 欧美亚洲大陆| 91视频成人免费| 欧美日韩影视| 精品久久久久久亚洲综合网站| 欧美激情日韩| 日韩免费一级| 日韩中文在线中文网在线观看| 97超碰免费在线| 91精品综合视频| 日韩精品视频免费播放| 男人看的污网站| 貂蝉被到爽流白浆在线观看| 日本深夜福利视频| 国产无人区码熟妇毛片多| 性开放的欧美大片| 亚洲精品456在线播放狼人| 亚洲亚洲人成综合网络| 色多多视频网站| а√中文在线8| 深夜福利av你懂的| 日本久久一区二区三区| bt7086福利一区国产| 亚洲av永久无码精品| www.桃色.com| 免费国产自久久久久三四区久久| 国产亚洲欧美精品久久久www| 都市激情亚洲色图| 中文字幕在线永久| 五月天激情小说综合| 欧美熟妇交换久久久久久分类| 国产精品亚洲欧美在线播放| 激情91久久| 亚洲午夜精品一区二区| 免费在线看黄网址| 成人不卡免费视频| 国产中文在线观看| 91国产一区在线| 欧美精品人人做人人爱视频| 国产91精品网站| 性高湖久久久久久久久aaaaa| 国产精品17p| 在线观看的毛片| 狠狠色丁香婷综合久久| 久草视频在线免费| 奇米影视一区二区三区| 99久久精品国产观看| 少妇愉情理伦片bd| 国产精品福利在线播放| 丁香资源影视免费观看| 国产精品酒店视频| 久久国产精品免费一区二区三区| 9999在线视频| 男人的天堂亚洲| zzijzzij亚洲日本成熟少妇| 久久精品视频观看| 精品一区二区三区在线播放视频| 亚洲欧洲成人| www.亚洲一区二区| 欧美激情亚洲自拍| 美日韩一级片在线观看| 91精品国产福利在线观看麻豆| 一级少妇精品久久久久久久| 日韩精品视频一区二区三区| 成人免费视频免费观看| 97精品国产91久久久久久| 欧美系列电影免费观看| 色婷婷狠狠五月综合天色拍| 久久66热re国产毛片基地| 亚洲自拍偷拍网址| 老牛嫩草一区二区三区日本| 一区二区三区视频免费观看| 久久99精品久久| 深夜国产在线播放| 农村妇女精品一区二区| 蜜桃视频无码区在线观看| 国产在线视精品麻豆| xxx亚洲日本| 一二三区在线视频| 国产suv精品一区二区三区88区| 三区视频在线观看| 一本久道久久综合狠狠爱亚洲精品| 男人午夜视频在线观看| 日韩综合小视频| 国产一区私人高清影院| 免费观看的av网站| zzijzzij亚洲日本成熟少妇| 日韩av网站在线免费观看| se视频在线观看| 国产网站在线播放| 国产成人h网站| 黑人と日本人の交わりビデオ| 免费观看一区二区三区毛片| 精品少妇v888av| 欧美一级二级三级区| 亚洲成人日韩| 韩日精品一区二区| 国产成人黄色网址| 欧美理论电影在线观看| 日本高清视频一区二区| 国产精品4hu.www| 人妻无码久久一区二区三区免费| 国产成+人+综合+亚洲欧美| 亚洲永久免费精品| 97超碰成人| 国产乱码久久久| 国产精品日韩欧美| 久久青草欧美一区二区三区| 国产又粗又猛又爽又黄的视频一| 亚洲AV无码国产成人久久| 亚洲电影在线一区二区三区| 884aa四虎影成人精品一区| 日本中文字幕亚洲| 男人日女人网站| eeuss影院eeuss最新直达| 国产欧美日韩小视频| 国产精品一卡二卡三卡| 成人欧美一区二区三区黑人| 国产一卡2卡3卡4卡网站免费| 99九九电视剧免费观看|