Wednesday, August 4, 2010

Handle keyboard input message


In this lesson, we will learn how to handle the keyboard WINDOWS procedure messages.

Theory:

Because most of the PC is only a keyboard, so all the running in the WINDOWS program Bixugongyong it. WINDOWS will be responsible for the keystroke message sent with the input focus to that application. Although the screen may also have several application windows, but only one window at a time with the input focus. Have the input focus of that application's caption is always high brightness display. In fact you can look at the keyboard message from two perspectives: First, you can see it as a collection of a lot of key information, in this case, when you press a key, WINDOWS will send a WM_KEYDOWN to have the input focus of that application, to remind it has a key is pressed. When you release the key, WINDOWS WM_KYEUP will send a message, telling a key is released. Each key as you put a button; the other is: you can put the keyboard as a character input device. When you press "a" key, WINDOWS send a message to have the input focus WM_CHAR the application, tell it "a" key is pressed. In fact WINDOWS send WM_KEYDOWN and WWM_KEYUP internal message to the application has input focus, and these messages will be translated into WM_CHAR by calling TranslateMessage news. WINDOWS window procedure function to decide whether the message received, in general you are not the General Assembly to deal with WM_KEYDOWN, WM_KEYUP message TranslateMessage function in the message loop will WM_CHAR message into the message. In our program will only handle WM_CHAR.

Examples:

.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; 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,
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL,
hInst, NULL
mov hwnd, eax
invoke ShowWindow, hwnd, SW_SHOWNORMAL
invoke UpdateWindow, hwnd
. WHILE TRUE
invoke GetMessage, ADDR msg, NULL, 0,0
. BREAK. IF (! Eax)
invoke TranslateMessage, ADDR msg
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; the character the program receives from keyboard

This variable will be saved to the character received from the keyboard. Because it is in the process window through WPARAM variable transmission, so we simply define it as type WPARAM. Since our initial refresh the window (that has just been created that a) there is no keyboard input so we put him in as the space character (20h), it appears you did not see anything.

. ELSEIF uMsg == WM_CHAR
push wParam
pop char
invoke InvalidateRect, hWnd, NULL, TRUE
This section is used to handle WM_CHAR messages. It is the received characters into the variable char in, then call InvalidateRect, but InvalidateRect make the window client area is invalid, so that it will issue a WM_PAINT message, the force WM_PAINT messages to its customers WINDOWS redrawn district. The function syntax is as follows:

InvalidateRect proto hWnd: HWND,
lpRect: DWORD,
bErase: DWORD

lpRect is the point we want the client area of a square structure invalid pointer.濡傛灉璇ュ?绛変簬NULL锛屽垯鏁翠釜瀹㈡埛鍖洪兘鏃犳晥锛涘竷灏斿?bErase鍛婅瘔WINDOWS鏄惁鎿﹂櫎鑳屾櫙锛屽鏋滄槸TRUE锛屽垯WINDOWS鍦ㄨ皟鐢˙eginPaint鍑芥暟鏃舵妸鑳屾櫙鎿︽帀銆傛墍浠ユ垜浠澶勭殑鍋氭硶鏄細鎴戜滑灏嗕繚瀛樻墍鏈夋湁鍏抽噸缁樺鎴峰尯鐨勬暟鎹紝鐒跺悗鍙戦?WM_PAINT娑堟伅锛屽鐞嗚娑堟伅鐨勭▼搴忔鐒跺悗鏍规嵁鐩稿叧鏁版嵁閲嶆柊缁樺埗瀹㈡埛鍖恒?灏界杩欎箞鍋氫簨鏈夌偣鍍忚蛋浜嗗紦鑳岋紝浣哤INDOWS瑕佸鐞嗛偅涔堝簽澶х殑娑堟伅缇わ紝娌℃湁涓?畾鐨勮鐭╁彲涓嶈銆傚疄闄呬笂鎴戜滑瀹屽叏鍙互閫氳繃璋冪敤GetDC 鑾峰緱璁惧涓婁笅鏂囧彞鏌勶紝鐒跺悗缁樺埗瀛楃锛岀劧鍚庡啀璋冪敤ReleaseDC閲婃斁璁惧涓婁笅鏂囧彞鏌勶紝姣棤鐤戦棶杩欐牱涔熻兘鍦ㄥ鎴峰尯缁樺埗鍑烘纭殑瀛楃銆備絾鏄鏋滆繖涔嬪悗鎺ユ敹鍒癢M_PAINT娑堟伅瑕佸鐞嗘椂锛屽鎴峰尯浼氶噸鏂板埛鏂帮紝鑰屾垜浠繖绋嶅墠鎵?粯鍒剁殑瀛楃灏变細娑堝け鎺夈?鎵?互涓轰簡璁╁瓧绗︿竴鐩存纭湴鏄剧ず锛屽氨蹇呴』鎶婂畠浠斁鍒癢M_PAINT鐨勫鐞嗚繃绋嬩腑澶勭悊銆傝?鍦ㄦ湰娑堟伅澶勭悊涓彂閫乄M_PAINT娑堟伅鍗冲彲銆?br />
invoke TextOut,hdc,0,0,ADDR char,1

鍦ㄨ皟鐢↖nvalidateRect鏃讹紝WM_PAINT娑堟伅琚彂閫佸埌浜哤INDOWS绐楀彛澶勭悊杩囩▼锛岀▼搴忔祦绋嬭浆绉诲埌澶勭悊WM_PAINT娑堟伅鐨勭▼搴忔锛岀劧鍚庤皟鐢˙eginPaint寰楀埌璁惧涓婁笅鏂囩殑鍙ユ焺锛屽啀璋冪敤TextOut鍦ㄥ鎴峰尯鐨勶紙0锛?锛夊杈撳嚭淇濆瓨鐨勬寜閿瓧绗︺?杩欐牱鏃犺鎮ㄦ寜浠?箞閿兘鑳藉湪瀹㈡埛鍖虹殑宸︿笂瑙掓樉绀猴紝涓嶄粎濡傛锛屾棤璁烘偍鎬庝箞缂╂斁绐楀彛锛堣揩浣縒INDOWS閲嶆柊缁樺埗瀹冪殑瀹㈡埛鍖猴級锛屽瓧绗﹂兘浼氬湪姝g‘鐨勫湴鏂规樉绀猴紝鎵?互蹇呴』鎶婃墍鏈夐噸瑕佺殑缁樺埗鍔ㄤ綔閮芥斁鍒板鐞哤M_PAINT娑堟伅鐨勭▼搴忔涓幓銆?br />





相关链接:



Mkv To Vob



Holiday Birth to "steal food hand job"



Premier Kids Education



Suspected Of Extortion Donews Producer Liu Ren Denies Allegations



convert avi To wmv free download



JSP variable in the scope of the specification



HP, The "total"



New XML Or CSS Tools



Log Analysers Comparison



Alibaba CEO Wei Zhe: mergers and acquisitions in the domestic launch



Ps3 rmvb



Experts say too early to lower domestic oil Prices



avi converter TO mp4



Barbed words! Photoshop special effects make the word cactus



Sunday, July 25, 2010

Kunlun Hotel Liaocheng use Maxima



Kunlun Hotel is located in Liaocheng, Liaocheng center of Hebei perfect location with convenient transportation. Hotels around the beautiful, unique architectural style, luxury high-end interior decoration, all kinds of facilities, is the accommodation, catering, meetings, training, an ideal place for business and other activities.

December 2009, Liaocheng Hotel Kunlun Hotel Management System using Maxima's front management, catering management system, administrative system, members of integral management systems.








Recommended links:



avi to Ipod touch



flac to mp3 converter FREE



Michael Dell back the first three FIRE burning



flv to mp3 CONVERTER free download



sybase Basics



E-Mail Clients Shop



Sources said the original 360 odd tiger head Jingwei Fu Sheng has joined venture CAPITAL



Deployment on the faltering transition Haier PC refraction



BPR get to the Root



FTP Clients comments



Paladin examination and topics FOR 4 years (1)



Alternative "Turtle", Alumni Cenan Bin



Flv to mp3 converter



LISTS Graphic



Wednesday, July 21, 2010

The composition of a GIS


The composition of a GIS

GIS consists of five main elements of the components: hardware, software, data, personnel and methods.

Hardware

GIS hardware is operated by computer. Today, GIS software can run on many types of hardware.
From a central computer server to the desktop computer to the network from a single environment.

Software

GIS software provides the necessary storage, analysis and display of geographic information features and tools. The main software components are:

Geographic information input and processing tools
Database management system (DBMS)
Support geographic query, analysis and visualization tools
Easy to use graphical user interface of these tools (GUI)
Data

A GIS system is the most important parts of data. Geographic data and related tabular data can own collection or from purchased commercial data providers. GIS spatial data and other data will source data integration with, and most companies can use those data to organize and save the database management system to manage spatial data.

Staff

GIS technology to manage the system if no one applied to practical problems and planning will be of little value. GIS users range from design and maintenance of the system of technical experts, to those who use the system and complete their daily staff.

Method

Successful GIS system, with good design plans and laws of their own affairs, these are the norms and specific to each company's operating practice is unique.






Recommended links:



Newsgroup Clients Evaluation



Youtube MOVIE to MAC Guide



Digital CD CDA Audio to M4A Copy



Photoshop to create beauty facial skin texture



Youtube FLV to Xbox 360 Platinum



Lohan DVD to AVI



Converter mp4 to 3gp free download



BLACKBERRY video format



Vob File Converter



Youtube FLV to DAT Home



convert mkv to avi Free



Flash highlights examples of forms produced (6)



Hot Java And JAVASCRIPT



Monday, July 5, 2010

Happiness Apple TV Encode

Happiness Apple TV Encode is a very easy convert your favorite movies from AVI , DIVX, MOV, MPEG, QuickTime, VCD, DVD, WMV, ASF, RM, RMVB to Apple TV. and convert popular audio files including WMA, MP2, OGG, RA, AC3, APE, CDA, etc to Apple TV MP3, AAC. Extremely fast conversion speed and friendly user interface let you convert video files between many formats with ease. The powerful features and unbeatable price make Happiness Apple TV Encode an affordable and powerful video conversion solution on personal computer.



Recommand Link:



Youtube to VHS Professional



APOLO Apple TV Video Converter



Youtube Movie Save + Player Plus



Wmv



New Graphic CAD



GoldfishHD DVD to iPod Video Ripper



AVS-Media AUDIO Tools



ImTOO Xbox Converter



Christmas-Idea 3GPP Converter



X-Cloner PS2 Converter



Adventure And Roleplay Wizard



Download HD To Cowon S9 Soft



AaleSoft Ultimate Video Converter



Recommend Kids Education



Friday, June 25, 2010

Youtube FLV Save + Converter Tools

Hot popluar youtube video Converter + download + player tool. With YouTube tool you can also convert downloaded YouTube videos to a format compatible with your favorite portable device; including - iPod Video, iPod Touch, iPod Nano, iPhone, Zune, PSP, as well as video capable MP3 players, video capable mobile phones, and Pocket PC, And finally... YouTube tool's embedded player will allow you to watch all your favorite YouTube videos off-line. So now you can enjoy any .flv and .swf videos anytime!
Easily Convert all popular video formats. Provides the highest speed to download YouTube video. Support unlimited simultaneous downloading tasks. Supports auto-name your downloaded video title as the YoutTube page shows. Offers you the most convenient task management and the easiest control capability. About Conversion Features. - is the most powerful YouTube assistant on the planet.



Recommand Link:



Ever CDA WAV APE To MP2 Maker



Explosion DVD Backup



Directory Astrology Or BIORHYTHMS Or Mystic



Youtube FLV to PSP Home



Comments Games Kids



Youtube to Xbox 360 Suite



for you Flash Tools



SuperBurner VOB to MPEG



DVD To iPhone Converter FOR MAC(intel)



Explosion Pocket PC Converter



Youtube Movie to AVI Application



SuperBurner VOB to MPEG



Swift MPEG to xBox 360



HD to Zune HD CONVERTER



youtube Video format



Converting Video To IPod Nano 4Gen



Saturday, June 12, 2010

Youtube FLV to Divx Top Rated

It's most popular and very easy to use YouTube tools. helps you Fast download, convert, play, manage your favorite YouTube videos. If you're a YouTube fan, you'll love YouTube tool! is the most powerful YouTube assistant on the planet. YouTube tool easily: 1. Fast downloads YouTube videos, 2. Supports unlimited simultaneous downloads (a real time saver!), 3. Automatically names the downloaded video the same as the YouTube title, 4. Converts YouTube videos to various video formats, including Video, DVD, VCD, AVI, MPG, MPEG, Divx, Xvid, WMV, RM, RMVB, MOV, MP4, 3GP, SWF, DAT, H264, VOB, Flash, PDA, M4V, 3G2, AMV, CDA, DV,QuickTime, ASX, TV, VHS, FLV, H264, BDMV, MAC, Apple TV, Zune, iPod, PDA, PSP, PS2, PS3, Xbox, Xbox 360, Mobile Phone, Cell Phone, Blackberry, Wii, Laptops, Printers, Palm OS, Pocket PC, PPC, Treo, Psion, EPOC, iphone.
Supports customize or create user's own profile for any new (portable) device. The video conversion supports preview. About Playing Features. Embedded YouTube Video (Offline) Player is available, it supports offline play YouTube video, .flv video and .swf video. Supports "Drag and Drop" video files direct to the main window. Easy to select the source files. Cool UI skin available. - is the most powerful YouTube assistant on the planet.



Recommand Link:



Hope MPEG4 to iPod



WorldCup MPG to DVD



Youtube FLV Backup + Player Pack



Top Ad Blockers



BLACKBERRY to WAVE Cloner



Compare Adventure And Roleplay



Brief Screen Capture



Youtube FLV to PSP TOP Rated



Explosion FLV Converter



cool utility download site



Merry CD WMA CD-R to Sound Creator



Magic Audio Converter



Easy AVI/VCD/DVD/MPEG Converter



How To Creator MPC Mixer



Friday, June 11, 2010

Youtube FLV to Blackberry Gold

It's most popular and very easy to use YouTube tools. helps you Fast download, convert, play, manage your favorite YouTube videos. If you're a YouTube fan, you'll love YouTube tool! is the most powerful YouTube assistant on the planet. YouTube tool easily: 1. Fast downloads YouTube videos, 2. Supports unlimited simultaneous downloads (a real time saver!), 3. Automatically names the downloaded video the same as the YouTube title, 4. Converts YouTube videos to various video formats, including Video, DVD, VCD, AVI, MPG, MPEG, Divx, Xvid, WMV, RM, RMVB, MOV, MP4, 3GP, SWF, DAT, H264, VOB, Flash, PDA, M4V, 3G2, AMV, CDA, DV,QuickTime, ASX, TV, VHS, FLV, H264, BDMV, MAC, Apple TV, Zune, iPod, PDA, PSP, PS2, PS3, Xbox, Xbox 360, Mobile Phone, Cell Phone, Blackberry, Wii, Laptops, Printers, Palm OS, Pocket PC, PPC, Treo, Psion, EPOC, iphone.
Supports customize or create user's own profile for any new (portable) device. The video conversion supports preview. About Playing Features. Embedded YouTube Video (Offline) Player is available, it supports offline play YouTube video, .flv video and .swf video. Supports "Drag and Drop" video files direct to the main window. Easy to select the source files. Cool UI skin available. - is the most powerful YouTube assistant on the planet.



Recommand Link:



OneClick RA Value



Youtube FLV to DAT Live



Recommend MAIL Servers



ACA Screen RECORDER



ISkysoft DVD to iPod Converter for Mac



Video Convert Master



AlltoDVD Flash Converter



Youtube Movie To M4V Plus



cool utility DOWNLOAD site



Open SWF To DVD



Games Arcade Directory



Cucusoft iPod Video + DVD Converter



Easy Help Tools



Digital CD AAC AC3 to WAVE Maker



Happiness VCD To DVD VOB