Window programs under Windows

Source: Internet
Author: User
Tags prototype definition

Further,

.386. Model Flat,stdcalloptionCaseMap:noneinclude Windows.Incinclude User32.Incincludelib user32.libinclude kernel32.Incincludelib kernel32.libwinmain Proto:D Word,:D Word,:D Word,:D word;WinMain function prototype definition. Dataclassname DB"Simplewinclass",0AppName DB"My First Window",0.                            DATA? ;no initialized datahinstance hinstance?            CommandLine LPSTR? ;string pointer variable. CODEStart:;----------------------------------------------------------------------------------------------------------- ;get the handle to the applicationInvoke Getmodulehandle,nullmovHinstance,eax;---------------------------------------------------------------------------------------------------------- -;get command line argumentsInvoke GetCommandLinemovCommandline,eax;Call the WinMain functionInvoke Winmain,hinstance,null,commandline,sw_showdefault;----------------------------------------------------------------------------------------------------------- ;exit the applicationInvoke Exitprocess,eax;----------------------------------------------------------------------------------------------------------- WinMain procHInst:HINSTANCE,Hprevinst:HINSTANCE,CmdLine:LPSTR,cmdshow:DWORD LOCALWC:wndclassex LOCALmsg:MSG LOCALhwnd:HWND;----------------------------------------------------------------------------------------------------------- ;Register window classmovwc.cbsize,sizeof wndclassexmovWc.style,cs_hredraworCs_vredrawmovWc.lpfnwndproc,offset WndProc;Specifies the window's callback functionmovWc.cbclsextra,nullmovWc.cbwndextra,nullPushhinstancePopWc.hinstance;Save instance handle for windowmovwc.hbrbackground,color_window+1                ;the background color of the windowmovWc.lpszmenuname,nullmovWc.lpszclassname,offset ClassName Invoke Loadicon,null,idi_applicationmovWc.hicon,eaxmovWc.hiconsm,eaxinvoke Loadcursor,null,idc_arrowmovwc.hcursor,eaxinvoke registerclassex,addr WC;----------------------------------------------------------------------------------------------------------- ;Creating a Window objectinvoke Createwindowex,null, ADDR ClassName, ADDR AppName, Ws_overlappedwindow,            Cw_usedefault, Cw_usedefault, Cw_usedefault, Cw_usedefault, NULL, NULL, hInst, NULLmovHwnd,eax;----------------------------------------------------------------------------------------------------------- ;Display windowInvoke Showwindow,hwnd,cmdshow;----------------------------------------------------------------------------------------------------------- ;Refresh window client areaInvoke Updatewindow,hwnd;----------------------------------------------------------------------------------------------------------- ;Enter the loop that gets the window message . While TRUE invoke Getmessage,addr Msg,null,0,0     . Break. IF (!eax) Invoke Translatemessage,addr msg invoke dispatchmessage,addr msg. ENDWmovEax,msg.wparamretWinMain ENDP;----------------------------------------------------------------------------------------------------------- ;Window callback functionWNDPROC prochWnd:HWND,umsg:UINT,WParam:WPARAM,LParam:LPARAM;Close Message-Exit processing. IF Umsg==wm_destroy invoke Postquitmessage,null. ELSE Invoke Defwindowproc,hwnd,umsg,wparam,lparamret. endifXOREax,eaxretWndProc ENDP End Start

Window programs under Windows

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.