锘??xml version="1.0" encoding="utf-8" standalone="yes"?> 4 free icons of iPhone, designed in scribbled style. By: Dirceu Veiga Icons in package: 4 12 freeware “iPhone-like” icons of Web 2 Social Bookmarks for use in blogs, websites, desktops, softwares. By: Dirceu Veiga Icons in package: 12 By: Dirceu Veiga Icons in package: 2 By:Dirceu Veiga Icons in package: 1 By:Dirceu Veiga Icons in package: 4 There are many types icons for free download, like PlayStation 3, SuperMan Returns, Star Wars…etc.. By: yellowicon team This package includes icons inspirated on the new iPhone Icons in package: 12 Icons size: 256×256 Icons formats: PNG, ICO These icons designed by a chinese. By: yichi By: Alejandro Lopez Icons in package: 6 Icons by FastIcon.com: This artist has 41 icon sets containing 657 total icons for Mac OS X listed on InterfaceLIFT. The sets are shown in order of popularity. There are many cartoon and film icons in the website include Transormers, Finding Nemo, Dragon Ball… 9 PNG icons based on the design of Adobe CS3’s applications’ boxes By: Pedro de la Luna Icons in package: 9 Including 28 icons, three for each CS3 application (Application - File - Folder) and one empty folder. By: Pedro de la Luna Icons in package: 9 Free for personal use only, if for commercial use, need payment. By: Pedro de la Luna Icons in package: 86 By: Kuswanto Download: 104 Standard PC Keyboard Key Icons By: Alan Who Icons in package: 104 Download: There are 248 icon sets in Mac OS X. It is like a Bee collect many interesting free icon download website. VistaIcons.com is a collection of free Vista Style icon sets of over 2500 high quality icons in png and ico format. From VistaIcons.com you can freely download 256×256 PNG icons for Windows Vista It has a big database of Windows icon artists and designers. It is apersonal site and web playground of Birmingham (UK) based developer Mark James. There are many sets of icon for free download include silk web icons, flag icons… IconBuffet is home to a tasty plethora of free icons. Collect them, download them, trade them with your friends. They’re kinda like baseball cards, only without the steroids. And you can use them on your website. InterfaceLIFT is your source for graphical user interface enhancements for Mac OS X, Microsoft Windows, and Linux. They specialize in desktop wallpaper, icons, themes, and news with a focus on community. New content is posted virtually every day. There are 497225 quality icons in 175 icon collections… and counting. Here you´ll find the best icons from the best artists in the world. The icons here listed belong to the individual authors and companies. They are free for personal and non commercial use. If you are an icon artist and desire to share your work with the world, this is your place. Just click on the submit menu and follow the easy steps to add your icons. A list of 90 icon packs that you can download for free.
璇戯細鑱傚厓鏈?
1. The Simplest Windows Program
1.鏈綆鍗曠殑Windows紼嬪簭
Before you can even begin thinking about programming in Windows, you have to be able to understand how this simple program works.
鍦ㄤ綘寮濮嬫兂濡備綍鍦╳indows涓嬬紪紼嬩箣鍓嶏紝浣犲繀欏昏寮勬竻妤氫笅闈㈣繖涓畝鍗晈indows紼嬪簭鐨勫伐浣滃師鐞嗐?
Windows API calls are highlighted in blue and Windows specific data types are shown in green. I will also usually put a double colon in front of API calls. In C++, that simply means that I'm calling a global function, in case there is some ambiguity.
鎴戠敤钃濊壊鏉ユ爣璇哤indows鐨凙PI璋冪敤錛岀敤緇胯壊鏉ユ爣璇哤indows涓殑鐗規畩鐨勬暟鎹被鍨嬨傚悓鏃舵垜鍦ˋPI鍑芥暟鐨勫墠闈㈡斁緗簡涓瀵瑰啋鍙?:銆傚湪C++涓紝榪欏鍐掑彿灝辨槸鍛婅瘔緙栬瘧鍣ㄦ垜鍦ㄨ皟鐢ㄤ竴涓叏灞鍑芥暟銆傜敱浜庢湁鏃跺欐湁鍚屽悕鐨勫嚱鏁幫紝涓轟簡涓嶅紩璧鋒販娣嗭紝鍦ㄥ墠闈㈡斁緗啋鍙鋒槸涓縐嶅緢濂界殑鍋氭硶
Sources (zipped file 4k) are right here. Remember to compile them as a Windows application. For instance, in Visual C++ select File.New.Projects.Win32 Application. Otherwise you'll get the error: unresolved external _main. (I provided project file Winnie.dsp for those of you who use MS VC++ 6.0 and Winnie.sln for the users of VC++ 7.0)
鎴戞彁渚涗簡婧愪唬鐮?涓涓?k澶у皬鐨勫帇緙╂枃浠?銆傝璁頒綇瑕佹妸瀹冧滑緙栬瘧鎴愪竴涓獁indows搴旂敤紼嬪簭鑰屼笉鏄痺indows鎺у埗鍙扮▼搴忋傚惁鍒欙紝浣犲氨浼氬緱鍒版壘涓嶅埌main鍑芥暟鐨勯敊璇傚湪VC++6.0涓紝鎴戜滑鍙互閫氳繃閫夋嫨File鈥斺擭ew Projects鈥斺擶in32 Application鏉ュ垱寤轟竴涓獁indows搴旂敤紼嬪簭鐨勫伐紼嬨傚綋鐒訛紝浣犵敤涓嶇潃榪欎箞鎷呭績錛屾垜宸茬粡鎻愪緵浜嗕袱涓仛濂界殑宸ョ▼鏂囦歡緇欎綘銆備竴涓槸winnie.dsp錛屼綘鍙互鍦╒C++6.0涓嬩嬌鐢ㄣ備竴涓槸Winnie.sln錛屼綘鍙互鍦╒C++7.0涓嬩嬌鐢ㄣ?
First, in a Windows program, you have to define a Window Class, the "class" of window(s) that will be displayed by your application (not a C++ class). In our case we will display only one window, but still, we need to give Windows some minimal information about its Class. The most important part of the WinClass (now, that's a C++ class that describes the Window Class) is the address of the callback procedure, or the Window Procedure. Windows is supposed to call us--Windows sends messages to our program by calling this procedure.
濂戒簡錛岃鎴戜滑鏉ョ湅鐪嬪浣曞啓榪欎釜鏈綆鍗曠殑紼嬪簭鍚с傞鍏堬紝鍦ㄤ竴涓獁indows紼嬪簭閲岄潰錛屼綘闇瑕佸畾涔変竴涓獥鍙g被錛屾敞鎰忚繖涓被鐨勬蹇典笉鍚屼簬C++涓殑綾伙紝榪欎釜紿楀彛綾葷浉褰撲簬C璇█涓殑緇撴瀯浣擄紝浣犳妸榪欎釜緇撴瀯浣撳~濂戒簡錛岀劧鍚庝綘鐨勫簲鐢ㄧ▼搴忓氨浼氭牴鎹綘濉殑榪欎簺淇℃伅鏉ユ樉紺虹獥鍙c傚湪鎴戜滑鐨勪緥瀛愰噷闈紝鎴戜滑浠呬粎鏄劇ず涓涓獥鍙c備絾鏄氨綆楁槸榪欐牱錛屾垜浠篃蹇呴』瑕佺粰鎴戜滑鐨勭獥鍙f渶灝戠殑紿楀彛綾諱俊鎭傝屽叾涓渶閲嶈鐨勯儴鍒嗗氨鏄洖璋冨嚱鏁頒簡錛屾湁鏃跺欐垜浠篃縐板畠涓虹獥鍙h繃紼嬨傚叾瀹炶繖鏄竴涓嚱鏁版寚閽堬紝姣忔紼嬪簭闇瑕佸鐞嗘秷鎭殑鏃跺欙紝windows灝遍氳繃榪欎釜鍑芥暟鎸囬拡鏉ヨ皟鐢ㄦ垜浠啓濂界殑鍥炶皟鍑芥暟銆傛槸鐨勶紝浣犵湅鍒幫紝鏄痺indows璋冪敤鎴戜滑緙栧啓鐨勫嚱鏁般備綘榪樿寰楀嚱鏁版寚閽堝悧錛熷鏋滀笉鏄緢娓呮錛屽彲浠oogle涓涓嬶紝o(∩_∩)o…
Notice the declaration of WindowProcedure. Windows calls it with a handle to the window in question, the message, and two data items associated with the message, the paramters, WPARAM and LPARAM.
璁╂垜浠湅鐪媁indowProcedure(紿楀彛榪囩▼銆佸洖璋冨嚱鏁?鐨勫畾涔夈備粩緇嗙湅涓涓嬶紝絎竴涓嚱鏁版槸涓涓彞鏌勶紝涔熷氨鏄釜鏁存暟銆俉indows鐢ㄥ畠鏉ュ尯鍒槸鍝釜紿楀彛銆傜劧鍚庢槸娑堟伅錛岀劧鍚庢槸涓庢秷鎭叧緋誨瘑鍒囩殑涓や釜鍙傛暟WPARAM鍜孡PARAM銆傝繖涓垜鏈潵鎯寵涓涓嬶紝鐣欏埌浠ュ悗鍚э紝姣曠珶鍘熸枃涓湪榪欓噷娌℃湁璁層?
In WinClass we also have to specify things like the program instance handle HINSTANCE, the mouse cursor (we just load the standard arrow cursor), the brush to paint the window's background (we chose the default window color brush), and the symbolic name of our class (you don't have to understand the meaning of all those yet).
鍦ㄤ笅闈㈢殑WinClass綾諱腑鎴戜滑蹇呴』緇欎竴浜涚獥鍙g被鐨勫瓧孌佃祴鍊鹼紝濡傜獥鍙g殑瀹炰緥鍙ユ焺HINSTACE,榧犳爣鍏夋爣(鎴戜滑浠呬粎鍔犺澆浜嗘爣鍑嗙殑綆ご榧犳爣)錛岀敾紿楀彛鑳屾櫙鐨勭敾鍒?鎴戜滑鐢ㄧ殑鏄獥鍙g己鐪佺殑鑳屾櫙棰滆壊鐢誨埛)錛屾渶鍚庤繕鏈夌獥鍙g被鐨勫悕瀛?紿楀彛綾葷殑鍚嶅瓧鏈濂藉拰鍒漢鐨勪笉鍚?.(褰撶劧錛岀幇鍦ㄤ綘涓嶉渶瑕佸紕鏄庣櫧榪欎簺鍙傛暟鐨勬剰涔?
Once all the fields of WNDCLASS are filled, we register the class with the Windows system.
涓鏃︽垜浠妸WNDCLASS緇撴瀯浣撳~瀹屼簡錛屾垜浠氨閫氳繃璋冪敤RegisterClass鍑芥暟鍦╳indows緋葷粺涓敞鍐屾垜浠殑紿楀彛綾匯傚ソ浜嗭紝鍏堢湅鐪嬫垜鏄庢牱灝佽WNDCLASS鍒頒竴涓猈inClass綾諱腑鍘葷殑銆?
#include <windows.h>
LRESULT CALLBACK WindowProcedure
(HWND hwnd, unsigned int message, WPARAM wParam, LPARAM lParam);
class WinClass
{
public:
WinClass (WNDPROC winProc, char const * className, HINSTANCE hInst);
void Register ()
{
::RegisterClass (&_class);//now we don’t deal with the error
}//we will process the error in the next version
private:
WNDCLASS _class;//define a private WNDCLASS object member
};
WinClass::WinClass
(WNDPROC winProc, char const * className, HINSTANCE hInst)
{
_class.style = 0;
_class.lpfnWndProc = winProc; // window procedure: mandatory
_class.cbClsExtra = 0;
_class.cbWndExtra = 0;
_class.hInstance = hInst; // owner of the class: mandatory
_class.hIcon = 0;
_class.hCursor = ::LoadCursor (0, IDC_ARROW); // optional
_class.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1); // optional
_class.lpszMenuName = 0;
_class.lpszClassName = className; // mandatory
}
Once the Window Class is registered, we can proceed with the creation of a window. This is done by calling the CreateWindow API. It takes a lot of arguments: the name of the window class that we have just registered, the caption that will appear in the title bar, window style, position, size, and the application instance. The rest of the arguments, for the time being, will be left equal to zero.
涓鏃︾獥鍙g被娉ㄥ唽鎴愬姛錛屾垜浠氨鍙互鐢ㄥ畠鏉ュ垱寤轟竴涓獥鍙c傛垜浠氳繃璋冪敤CreateWindow榪欎釜API鍑芥暟鏉ュ畬鎴愬畠銆傚畠鏈夊緢澶氬弬鏁幫紝榪欏彲鑳借浣犳湁鐐圭儲錛屼笉榪囦笉瑕佽繘錛屼綘鍙鍐欎竴嬈″氨濂戒簡銆傝繖浜涘弬鏁板寘鎷細鎴戜滑鍒氬垰娉ㄥ唽濂界殑紿楀彛綾葷殑鍚嶅瓧(榪欎釜瑕佹槸鎼為敊浜嗭紝浣犵殑紿楀彛鍙兘灝卞嚭涓嶆潵浜?,鎴戜滑紿楀彛鐨勬爣棰樻爮涓婄殑鏍囬錛岀獥鍙g殑鏍峰紡錛屼綅緗紝澶у皬榪樻湁搴旂敤紼嬪簭鐨勫疄渚嬪彞鏌勩傚墿涓嬬殑鍙傛暟鏆傛椂鎴戜滑榪樹笉闇瑕佺敤鍒幫紝鎴戜滑鎶婂畠浠垵濮嬪寲涓?銆?
This part of the program can also be encapsulated into a C++ class, WinMaker.
紼嬪簭鐨勮繖閮ㄥ垎涔熻鎴戝皝瑁呭埌浜嗕竴涓狢++鐨勭被WinMaker褰撲腑銆?
The window will not appear on the screen until you tell Windows to show it.
灝辯畻浣犲垱寤哄ソ浜嗙獥鍙o紝浣嗕綘榪樻槸鐪嬩笉鍒幫紝浣犲繀欏昏皟鐢⊿howWindow鍑芥暟璁╁畠鏄劇ず銆?
class WinMaker
{
public:
WinMaker (): _hwnd (0) {}
WinMaker (char const * caption,
char const * className,
HINSTANCE hInstance);
void Show (int cmdShow)
{
::ShowWindow (_hwnd, cmdShow);
::UpdateWindow (_hwnd);
}
protected:
HWND _hwnd;
};
WinMaker::WinMaker (char const * caption,
char const * className,
HINSTANCE hInstance)
{
_hwnd = ::CreateWindow (
className, // name of a registered window class
caption, // window caption
WS_OVERLAPPEDWINDOW, // window style
CW_USEDEFAULT, // x position
CW_USEDEFAULT, // y position
CW_USEDEFAULT, // witdh
CW_USEDEFAULT, // height
0, // handle to parent window
0, // handle to menu
hInstance, // application instance
0); // window creation data
}
A Windows program is event-driven. It means that you, as a programmer, are supposed to be on the defensive. The user will bombard Windows with various input actions, and Windows will bombard your program with messages corresponding to these actions. All you have to do is to respond to these messages. The picture below shows schematically how it works.
Windows紼嬪簭鏄簨浠墮┍鍔ㄧ殑銆傝繖灝辨槸璇翠綘浣滀負涓涓獁indows紼嬪簭鍛橈紝鎵鍋氱殑搴旇鏄槻寰″紡緙栫▼銆傚叾瀹炰篃娌℃湁榪欎箞涓ラ噸銆傚叿浣撴潵璇村氨鏄紝鐢ㄦ埛浼氬彂緇檞indows澶氱杈撳叆琛屼負錛岃寃indows鎶婅繖浜涜緭鍏ョ敤娑堟伅鐨勬柟寮忓彂緇欎綘鐨勭▼搴忋傝屼綘錛屾墍鍋氱殑灝辨槸閽堝姣忎竴涓秷鎭湪鍥炶皟鍑芥暟涓仛鍑哄鐞嗐備笅闈㈢殑榪欏紶鍥劇ず鎰忔х殑璇存槑浜嗚繖涓繃紼嬨傚浘鍦ㄤ笅涓欏電殑涓嬩竴欏碉紝o(∩_∩)o…
Windows gets various events from the keyboard, the mouse, the ports, etc. Each event is quickly converted into a message. Windows (the operating system) dispatches messages to appropriate windows. For instance, all keyboard messages go to the window that currently has the input focus (the active window). Mouse messages are dispatched according to the position of the mouse cursor. They usually go to the window that is directly under the cursor (unless some program captured the mouse).
棣栧厛,windows緋葷粺浠庨敭鐩樸侀紶鏍囥佺鍙g瓑絳夊悇縐嶈澶囦腑鑾峰緱鍚勭浜嬩歡銆傛瘡涓簨浠惰蹇熺殑杞崲涓烘秷鎭俉indows鍒嗘淳榪欎簺娑堟伅緇欏悎閫傜殑紿楀彛銆備婦涓緥瀛愶紝鎵鏈夌殑閿洏娑堟伅閮戒細浼犵粰褰撳墠鍏鋒湁杈撳叆鐒︾偣鐨勭獥鍙?涔熷氨鏄墍璋撶殑媧誨姩紿楀彛)銆傞紶鏍囨秷鎭垯浼氭牴鎹紶鏍囧厜鏍囨墍鍦ㄧ殑浣嶇疆鍒嗘淳緇欑浉搴旂殑紿楀彛銆傝繖浜涚獥鍙i氬父鏄洿鎺ヤ綅浜庡厜鏍囦笅鐨勭涓涓獥鍙?闄ら潪鏈夋煇浜涚▼搴忔崟鑾烽紶鏍囨秷鎭?銆?
All these messages end up in message queues. Windows keeps a message queue for every running application (actually, for every thread). It is your duty to retrieve these messages one-by-one in what is called a message loop. Your program has to call GetMessage to retrieve a message. Then you call DispatchMessage to give it back to Windows. Couldn't Windows just go ahead and dispatch all these messages itself? In principle it could, but a message loop gives your program a chance to have a peek at them and maybe perform some additional actions before dispatching them. Or not...
鎵鏈夌殑娑堟伅閮芥斁鍦ㄦ秷鎭槦鍒楅噷闈€俉indows涓烘瘡涓涓繍琛岀殑搴旂敤紼嬪簭緇存姢涓涓秷鎭槦鍒?瀹為檯涓婏紝鏄負姣忎竴涓嚎紼?銆傛妸榪欎簺娑堟伅涓涓釜鐨勫彇鍑烘潵錛岃繖鏄綘鐨勮矗浠匯傞氬父鎴戜滑鎶婅繖孌典唬鐮佸彨鍋氭秷鎭驚鐜傚湪浣犵殑紼嬪簭閲岋紝棣栧厛璋冪敤GetMessage鍑芥暟鍙栧嚭涓鏉℃秷鎭紝鐒跺悗璋冪敤DispatchMessage鎶婂畠榪斿洖緇橶indows銆俉indows榪樹細閲嶆柊鍒嗘淳榪欎簺娑堟伅鍚?鍘熷垯涓婁笉浼氾紝浣嗘槸浣犲彲浠ュ湪娑堟伅寰幆涓嬌鐢≒eekMessage鍑芥暟鏉ユ煡鐪嬫秷鎭屼笉鍒嗘淳瀹冿紝鍥犱負鏌愪簺鎯呭喌涓嬶紝浣犻渶瑕佸湪鍒嗘淳榪欎簺娑堟伅涔嬪墠鍋氫竴浜涢澶栫殑宸ヤ綔銆?
Each message is addressed to a particular window. When you tell Windows to dispatch such a message, it will figure out the class of this window, find the associated Window Procedure, and call it. Every single message sent to our window will end up in our window procedure. It is now up to us to respond to it. So, do we have to respond appropriately to every possible type of Windows message? There a hundreds of them! Fortunately, no! We only need to intercept those messages that we are interested in. Everything else we pass back to Windows for default processing using DefWindowProc.
姣忎釜娑堟伅琚紶閫掑埌涓涓壒孌婄殑紿楀彛銆傚綋浣犲憡璇墂indows鍒嗘淳涓鏉′俊鎭殑鏃跺欙紝windows浼氬厛鎵懼嚭榪欎釜紿楀彛鐨勭被錛岀劧鍚庢壘鍒頒笌涔嬪叧鑱旂殑紿楀彛榪囩▼錛屾渶鍚庤皟鐢ㄨ繖涓獥鍙h繃紼嬨傛瘡涓彂閫佸埌鎴戜滑紿楀彛鐨勬秷鎭兘浼氬湪鎴戜滑鐨勭獥鍙h繃紼嬩腑緇堟銆傜幇鍦ㄨ疆鍒版垜浠潵澶勭悊榪欎簺娑堟伅浜嗐傚洜姝わ紝鎴戜滑蹇呴』瑕佸鐞嗘墍鏈夌殑娑堟伅綾誨瀷錛熶笉錛岃繖閲屾湁鍑犵櫨縐嶆秷鎭紝鎴戜滑鍙渶瑕佸鐞嗗鎴戜滑鏈夌敤鐨勬秷鎭氨鍙互浜嗐備絾鍏跺畠娑堟伅鎬庝箞鍔炲憿錛熶笉鐢ㄦ媴蹇冿紝鍏跺畠娑堟伅鎴戜滑閫氳繃璋冪敤DefWindowProc榪欎釜鍑芥暟鏉ヨ嚜鍔ㄥ鐞嗐?
Let's have a look at WinMain. The execution of a Windows program doesn't start in main--it starts in WinMain. In our WinMain, we create a WinClass and register it. Then we create an actual window (of the class we've just registered) and show it. Actually, WinMain is called with the appropriate show directive--the user might want to start the application minimized or maximized. So we just follow this directive. Next, we enter the message loop and keep retrieving and dispatching messages until GetMessage returns 0. At that point the message's wParam will contain the return code of the whole program.
璁╂垜浠湅鐪媁inMain榪欎釜鍑芥暟銆備竴涓獁indows鍑芥暟鐨勫紑濮嬩笉鏄痬ain鍑芥暟錛岃屾槸WinMain銆傚湪鎴戜滑鐨剋inMain鍑芥暟閲岋紝鎴戜滑鍒涘緩浜嗕竴涓猈inClass鐨勫璞inClass錛岀劧鍚庢垜浠湪windows涓敞鍐屼簡瀹冦傛帴涓嬫潵鎴戜滑鍒涘緩浜嗕竴涓獥鍙?鎴戜滑鍒氬垰娉ㄥ唽鐨勭獥鍙g被鎵瀵瑰簲鐨勭獥鍙?騫朵笖鏄劇ず瀹冦傚疄闄呬笂錛學inMain鐢變竴涓弬鏁版槸鐢ㄦ潵鎸囨槑紿楀彛鏄劇ず鏁堟灉鐨?榪欐牱錛岀敤鎴峰彲浠ユ寚瀹氱獥鍙f樉紺虹殑鏂瑰紡)鈥斺旂敤鎴峰彲鑳藉笇鏈涙墦寮榪欎釜紼嬪簭鐢ㄦ渶灝忓寲鎴栬呮渶澶у寲鐨勬柟寮忔墦寮錛屽洜姝わ紝鎴戜滑鍦ㄨ繖閲屽彧闇瑕佺洿鎺ヤ嬌鐢ㄨ繖涓弬鏁板氨鍙互浜嗐傜劧鍚庢垜浠繘鍏ユ秷鎭驚鐜茍涓嶆柇鍙栧嚭娑堟伅鍜岃繘琛屽垎媧撅紝鐩村埌GetMessage鍑芥暟榪斿洖0銆傝繖涓椂鍊欐秷鎭殑wParam鍙傛暟灝嗕細鍖呭惈鏁翠釜紼嬪簭鐨勮繑鍥炲箋?
int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst,
char * cmdParam, int cmdShow)
{
char className [] = "Winnie";
WinClass winClass (WindowProcedure, className, hInst);
winClass.Register ();
WinMaker win ("Hello Windows!", className, hInst);
win.Show (cmdShow);
The GetMessage API is an interesting example of the bizarre Microsoft Troolean (as opposed to traditional, Boolean) logic. GetMessage is defined to return a BOOL, but the documentation specifies three types of returns, non-zero, zero and -1. I am not making it up! Here's an excerpt from the help file:
GetMessage鍑芥暟鏄竴涓緢濂界瑧鐨勫井杞殑涓夊煎竷灝旂被鍨嬬殑渚嬪瓙銆侴etMessage鍑芥暟瀹氫箟鐨勮繑鍥炲兼槸BOOL綾誨瀷錛屼絾鏄枃妗e嵈鏄庣‘鎸囧嚭瀹冨惈鏈変笁縐嶈繑鍥炲鹼紝闈?銆?鍜?1銆傛垜涓嶆兂鍦ㄨ繖閲屽璐瑰彛鑸屻備笅闈㈡槸浠嶮SDN涓殑鎽樺綍銆?
· If the function retrieves a message other than WM_QUIT, the return value is nonzero.
· If the function retrieves the WM_QUIT message, the return value is zero.
· If there is an error, the return value is -1.
The other important part of every Windows program is the Windows Procedure. Remember, Windows will call it with all kinds of messages. All these messages can be ignored by sending them to DefWindowProc. There is only one message that we must intercept. That's the WM_DESTROY message that is sent by Windows when the user decides to close the window (by pressing the close button in the title bar). The standard response to WM_DESTROY is to post the quit message and return zero. That's all there is to it.
璁╂垜浠湅鐪嬫墍鏈墂indows紼嬪簭閮藉緢閲嶈鐨勫洖璋冨嚱鏁板惂銆備綘闇瑕佹敞鎰忕殑鏄紝windows灝嗕負鎵鏈夌殑娑堟伅璋冪敤榪欎釜鍑芥暟銆傛墍浠ュ墿浣欑殑娑堟伅涓瀹氳閫佺粰DefWindowProc鍘誨鐞嗐傚湪榪欓噷鎴戜滑鍙鐞嗕簡涓涓秷鎭傞偅灝辨槸WM_DESTROY銆傚綋鐢ㄦ埛瑕佸叧闂竴涓獥鍙g殑鏃跺欙紝windows浼氬彂閫佽繖涓秷鎭傛爣鍑嗙殑澶勭悊WM_DESTROY娑堟伅鏄彂閫佷竴鏉¢鍑烘秷鎭紝騫惰繑鍥?銆傚ソ浜嗭紝榪欏氨鏄垜浠璁茬殑鍏ㄩ儴浜嗐?_*
// Window Procedure called by Windows
LRESULT CALLBACK WindowProcedure
(HWND hwnd, unsigned int message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_DESTROY:
::PostQuitMessage (0);
return 0;
}
return ::DefWindowProc (hwnd, message, wParam, lParam );
}
]]>
涓漢鏈鍠滄鐨凷DK鍏ラ棬鏁欑▼ 浣跨敤C
http://www.relisoft.com/win32/index.htm
杈冨枩嬈㈢殑錛屼嬌鐢–++
http://adrianxw.dk/
涓浜涘叧浜巜indows涓嬬殑console鏂歸潰鐨凷DK鍑芥暟璋冪敤
http://www.functionx.com/win32/
This site's goal is to provide a few lessons on Win32 programming. Keep in mind that everything you can do with Win32 using a C++ compiler
http://www.mdstud.chalmers.se/~md7amag/code/wintut/
榪欎釜涓嶆槸澶ソ錛屼笉榪囩湅鐪嬩篃涓嶉敊
http://www.vckbase.com
寰堝婧愪唬鐮佸拰鏂囨湰璧勬枡錛屾枃妗o紝
http://www.csdn.net
榪欎釜涓嶇敤璇翠簡錛岄棶闂鐨勫ソ鍦版柟
http://ntt.cc/2008/05/12/over-480-free-and-fresh-icon-sets-help-you-to-create-your-beautiful-skins-and-themes-in-flex.html
鍚勭鍥捐〃璧勬簮绱㈠紩,欏轟究灝辯洿鎺ヤ粠鏀懼埌榪欓噷浜嗭紝鍏嶅緱榪樿鐐瑰嚮閾炬帴錛?br>
By: bartelmedesign
By: bartelmedesignFeedicons 2
(include Vista High PX, Office Space Icon Set for Windows Vista, iVista Icon Pack, iVista Icon Pack 2, XP Icons,Royalty Free Icons for Toolbar and Web,Friendly Fire Icon Pack,Yoritsuki Icons,Antique Icons,Vista Glass Folder Icons,Arzo Icons Vol. 1,Gaming Icons Pack,Mario Galaxy Luma Icons,Christmas Icons,Wifun Icons by Rokey,Grzanka’s Icons,Fantastic Dream by Rokey,Eico 1 year by Rokey,128×128 Icons Set 5,Antares Iconset,Perfect Fanstasy,Monster Icons,128×128 Icons Set 4,iMac Icons,Camino Icons,Nes Icons Pack,iLife and iWork ‘08 Icons,Mouse Category Season 03 etc…)![]()
]]>