国产激情自拍_国产9色视频_丁香花在线电影小说观看 _久久久久国产精品嫩草影院

首頁(yè) > 學(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ā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表

圖片精選

国产激情自拍_国产9色视频_丁香花在线电影小说观看 _久久久久国产精品嫩草影院
国产精品作爱| 亚洲欧美日韩综合精品网| 精品一区二区三区在线成人| 最近中文字幕mv免费高清电影| 粉嫩av一区| 中文字幕在线视频免费观看| 午夜视频在线免费| 国产porn在线| 天堂中文在线观看| 91av资源在线| 精品国产99久久久久久| av在线天堂| 导航福利在线| 在线一区观看| 丁香花在线电影| 国产高清大尺度一区二区不卡| 国产美女一区视频| 国产黄色免费电影| 免费高清av| 2021av天天| 国产美女在线看| av激情在线| 国产视频xxxx| 久热国产在线| 亚洲综合激情六月婷婷在线观看| 麻豆精品免费视频入口| 在线中文字幕视频| 国产麻豆一级片| 四虎免费播放| 精品国内自产拍在线视频| 九九久久久2| 国产日本在线| 高清欧美精品xxxxx在线看| av大片在线播放| 国产黄色高清在线| 午夜伦全在线观看| 国产美女在线观看| 久久精品免视着国产成人| 国产成人亚洲欧美电影| 国产九色porn网址| 成在在线免费视频| 欧美xxxx黑人又粗又长| 亚洲日本久久久午夜精品| 国产激情网址| 91黄色在线| 亚洲天堂电影在线观看| 国产成人午夜| 69精品视频| 精品麻豆视频| 羞羞视频在线观看免费| av日韩在线免费| av免费在线一区二区三区| 伊人精品影院| 亚洲图区综合| 日本在线视频www鲁啊鲁| 四虎成人欧美精品在永久在线| 亚洲第一成人在线视频| а√最新版地址在线天堂| 国产中文在线| 2018狠狠干| а√最新版地址在线天堂| 白浆爆出在线观看| 国产在线观看网站| 国产欧美日韩专区| 伊人影院在线视频| 亚洲妇熟xxxx妇色黄| 久热久精久品这里在线观看| 国产一区二区影视| 999福利在线视频| www.三级.com| 中文字幕日本在线观看| 精品国产丝袜高跟鞋| 日本h片在线观看| 国产一级视频| 欧美啪啪精品| 中文在线观看视频| 秋霞av在线| 国产视频三级在线观看播放| 精品极品三级久久久久| 狠狠狠狠狠狠操| av中文在线| 国产一二三区精品视频| 日本在线观看| 精品国内自产拍在线视频| 九色在线网站| 亚洲成a人v欧美综合天堂麻豆| 中文字幕av中文字幕| gogo在线高清视频| 精品一区二区三区免费站| 超碰在线影院| 色吊丝av中文字幕| 国产高清自拍视频在线观看| 超碰在线网址| 青青草中文字幕| 91欧美在线视频| 国产丝袜自拍| 国产一级激情| 天堂在线视频| 交换国产精品视频一区| av三级在线观看| 精品推荐国产麻豆剧传媒| 国产素人视频在线观看| 国产男女猛烈无遮挡免费视频| 青青草在线免费观看| 欧洲一区av| 蜜桃av在线免费观看| 精品999视频| 国产精品yjizz视频网一二区| 午夜av电影| 日本中文字幕在线播放| 国产有码在线| 日本中文字幕在线看| 中文字幕在线免费视频| 国产小视频福利在线| 国产精品入口麻豆免费| 国产福利热线视频| 亚洲图区欧美| 免费国产在线视频| 国产理论片免费观看| 国产亚洲精品午夜高清影院| 国产精品久久久久久久久鸭| 国产羞羞视频在线观看| 国产黄色免费在线观看| 亚洲第一区视频| 男人天堂v视频| 最近中文av字幕在线中文| 国产天堂视频| www.综合网.com| 狠狠色丁香婷婷| 中文字幕在线看精品乱码| 在线中文字幕第一页| 欧美日韩一区二区三区视视频 | 国产在线麻豆精品| 国产精品爱久久久久久久小说 | 国产区高清在线| h网址在线观看| 国产小视频在线观看| 天天艹天天操| 国产日本在线视频| 日本久久国产| 91高清国产| 国产一级影片| 日本片在线看| 国产videos| 中文字幕日本在线| 超碰在线网址| 在线中文字幕第一页| 成人免费一区二区三区牛牛 | 人成在线免费视频| 国产对白叫床清晰在线播放| 日韩a视频在线观看| 国产无遮挡又黄又爽免费网站 | 伊人影院蕉久影院在线播放| 国产视频资源| 国产理论在线观看| 激情网站在线| 日韩a视频在线观看| 国产精品久久久高清免费| 尤物视频免费在线观看| 久久国产精品黑丝| 黄污在线观看| 国产免费黄网站| 国产麻豆麻豆| 国产网站免费看| 国产日产精品久久久久久婷婷| 久热中文字幕在线观看| 全网国产福利在线播放| gogogogo高清视频在线| 亚洲成a人v欧美综合天堂麻豆| av三级在线观看| 日本成人a视频| 蜜桃视频网站在线| 老鸭窝av在线| 国产精品自拍在线观看| 午夜视频免费在线观看| 国产对白叫床清晰在线播放| 国产人成网在线播放va免费| 国产精品免费麻豆入口| 中文视频在线| 麻豆精品不卡国产免费看| 天天操天天射天天色| 国产日本韩国在线播放| 精品美女在线观看视频在线观看| 在线视频中文字幕第一页| 青青国产在线| 国产精品666| 午夜在线观看91| 午夜视频在线免费| 精品a在线观看| 狠狠狠综合7777久夜色撩人| 国产精品视频一区二区三区麻豆| 国产白浆在线| www.国产精品.com| 国产精品久久久久永久免费看| 在线观看视频污| 五月婷婷在线视频| av在线官网| 99在线免费观看| 中文字幕日本在线| 女同一区二区免费aⅴ|