亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? menus.html

?? This tutorial attempts to get you started developing with the Win32 API as quickly and clearly as po
?? HTML
字號:
<HTML><LINK HREF="style.css" REL="STYLESHEET" TYPE="text/css"><HEAD><TITLE>Tutorial: Menus and Icons</TITLE></HEAD><BODY><FONT SIZE="-1">[ <A HREF="./index.html">contents</A>| <A HREF="http://www.winprog.org/">#winprog</A>]</FONT><HR><H1>Menus and Icons</H1><P>Example: menu_one</P><IMG SRC="images/menu_one.gif" ALT="[images/menu_one.gif]" ALIGN="right"><P>This is just a small section to show how to add basic menus to your window.Usually you use a pre-made menu resource.  This will be in an .rc fileand will be compiled and linked into your .exe.  This is rather compilerspecific, commercial compilers will have a resource editor that you can useto create your menus, but for this example I will show the text of the .rcfile so you can add it in manually.  I usually have an .h file as well whichis included in both my .rc file and my .c source files.  This file containsthe identifiers for controls and menu items etc.<P>For this example you can start with the window code from simple_window and add thiscode into it as instructed.<P>First the .h file.  Usually called "resource.h"<PRE CLASS="LIST">#define IDR_MYMENU 101#define IDI_MYICON 201#define ID_FILE_EXIT 9001#define ID_STUFF_GO 9002</PRE>Not much there, but our menu will be pretty simple.  The names and values hereare up to you for the choosing.  Now we write our .rc file.<PRE CLASS="LIST">#include "resource.h"IDR_MYMENU MENUBEGIN    POPUP "&File"    BEGIN        MENUITEM "E&xit", ID_FILE_EXIT    END    POPUP "&Stuff"    BEGIN        MENUITEM "&Go", ID_STUFF_GO        MENUITEM "G&o somewhere else", 0, GRAYED    ENDENDIDI_MYICON ICON "menu_one.ico"</PRE><P>You will want to add the .rc file to your project or makefile depending on what toolsyou are using.<P>You also want to <CODE>#include "resource.h"</CODE> in your source file (.c) so thatthe menu command identifiers and the menu resource id will be defined.<P>The easiest way to attach the menu and icon to your window is to specify them when youregister the window class, like this:<PRE CLASS="SNIP">    wc.lpszMenuName  = MAKEINTRESOURCE(IDR_MYMENU);</PRE><PRE CLASS="SNIP">    wc.hIcon  = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_MYICON));    wc.hIconSm  = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_MYICON), IMAGE_ICON, 16, 16, 0);</PRE><P>Change that and see what happens.  Your window should now have a File and Stuffmenu with the respective items underneath.  That is assuming your .rc file wasproperly compiled and linked into your program.  (again, see compiler notes)<P>The icon in the top left of the window and on the task bar should now display the small custom icon thatwe specified.  If you hit Alt-Tab, the large version of the icon should be displayedin the application list.<P>I've used <CODE>LoadIcon()</CODE> to load the large icon because it's simpler, however it will onlyload icons at the default resolution of 32x32, so in order to load the smaller image, we need to use<CODE>LoadImage()</CODE>.  Be aware that icon files and resources can contain multiple images, and inthis case the ones I've supplied contain the two sizes that I'm loading.<P>Example: menu_two</P><P> An alternative to using a menu resource is to create one on the fly (or when yourprogram runs).   This is a bit more work programming wise, but adds flexibility andis sometimes necessary.<P>You can also use icons that aren't stored as resources, you could choose to store youricon as a seperate file and load it at runtime.  This would also give you the option ofallowing the user to select an icon of their choice with the common dialogs discussed later,or something to that effect.<P>Start again from simple_window without the .h or .rc added.  Now we willhandle the <CODE>WM_CREATE</CODE> message and add a menu to our window.<PRE CLASS="SNIP">#define ID_FILE_EXIT 9001#define ID_STUFF_GO 9002</PRE>Put these two id's at the top of your .c file this time, underneath your <CODE>#include</CODE>s.Next we add the following code into our <CODE>WM_CREATE</CODE> handler.<PRE CLASS="SNIP">    case WM_CREATE:    {        HMENU hMenu, hSubMenu;        HICON hIcon, hIconSm;        hMenu = CreateMenu();        hSubMenu = CreatePopupMenu();        AppendMenu(hSubMenu, MF_STRING, ID_FILE_EXIT, "E&xit");        AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT)hSubMenu, "&File");        hSubMenu = CreatePopupMenu();        AppendMenu(hSubMenu, MF_STRING, ID_STUFF_GO, "&Go");        AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT)hSubMenu, "&Stuff");        SetMenu(hwnd, hMenu);        hIcon = LoadImage(NULL, "menu_two.ico", IMAGE_ICON, 32, 32, LR_LOADFROMFILE);        if(hIcon)            SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)hIcon);        else            MessageBox(hwnd, "Could not load large icon!", "Error", MB_OK | MB_ICONERROR);        hIconSm = LoadImage(NULL, "menu_two.ico", IMAGE_ICON, 16, 16, LR_LOADFROMFILE);        if(hIconSm)            SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)hIconSm);        else            MessageBox(hwnd, "Could not load small icon!", "Error", MB_OK | MB_ICONERROR);    }    break;</PRE><P>This creates a menu almost the same as the one we had in the resource andattaches it to our window.  A menu that is assigned to a window is automaticallyremoved when the program terminates, so we don't need to worry about getting ridof it later.  If we did though, we could use <CODE>GetMenu()</CODE> and <CODE>DestroyMenu()</CODE>.<P>The code for the icons is pretty simple, we call <CODE>LoadImage()</CODE> twice, to load theicon as both a 16x16 size and a 32x32 size.  We can't use <CODE>LoadIcon()</CODE> at allbecause it will only load resources, not files.  We specify <CODE>NULL</CODE> for the instancehandle parameter because we aren't loading a resource from our module, and instead of a resourceID we pass in the name of the icon file we want to load.  Finally, we pass in the <CODE>LR_LOADFROMFILE</CODE> flag to indicate that we want the function to treat the string we give itas a filename and not a resource name.<P>If each call succeeds we assign the icon handle to our window with <CODE>WM_SETICON</CODE>, and if itfails we pop up a message box letting us know something went wrong.<P><B>NOTE:</B> that the <CODE>LoadImage()</CODE> calls will fail if the icon file isn't in the currentworking directory of the program.  If you are using VC++ and you run the program from the IDE, the currentworking directory will be the one the project file is in.  However if you run the program from the Debug orRelease directories from explorer or the command shell, then you'll need to copy the icon file into that directoryin order for the program to find it.  If all else fails, specify the full path to the icon, <CODE>"C:\\Path\\To\\Icon.ico"</CODE>.<P>Okay now that we have our menu, we need to make it do something.  This ispretty simple, all we need to do is handle the <CODE>WM_COMMAND</CODE> message.  Also we'll need to check which command we are getting and act accordingly.  Now our<CODE>WndProc()</CODE> should look something like this.<PRE CLASS="SNIP">LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam){    switch(Message)    {        case WM_CREATE:        {            HMENU hMenu, hSubMenu;            hMenu = CreateMenu();            hSubMenu = CreatePopupMenu();            AppendMenu(hSubMenu, MF_STRING, ID_FILE_EXIT, "E&xit");            AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT)hSubMenu, "&File");            hSubMenu = CreatePopupMenu();            AppendMenu(hSubMenu, MF_STRING, ID_STUFF_GO, "&Go");            AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT)hSubMenu, "&Stuff");            SetMenu(hwnd, hMenu);            hIcon = LoadImage(NULL, "menu_two.ico", IMAGE_ICON, 32, 32, LR_LOADFROMFILE);            if(hIcon)                SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)hIcon);            else                MessageBox(hwnd, "Could not load large icon!", "Error", MB_OK | MB_ICONERROR);            hIconSm = LoadImage(NULL, "menu_two.ico", IMAGE_ICON, 16, 16, LR_LOADFROMFILE);            if(hIconSm)                SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)hIconSm);            else                MessageBox(hwnd, "Could not load small icon!", "Error", MB_OK | MB_ICONERROR);        }        break;        case WM_COMMAND:            switch(LOWORD(wParam))            {                case ID_FILE_EXIT:                break;                case ID_STUFF_GO:                break;            }        break;        case WM_CLOSE:            DestroyWindow(hwnd);        break;        case WM_DESTROY:            PostQuitMessage(0);        break;        default:            return DefWindowProc(hwnd, Message, wParam, lParam);    }    return 0;}</PRE>As you can see we've got our <CODE>WM_COMMAND</CODE> all set up, and it even has another <CODE>switch()</CODE> in it.This <CODE>switch()</CODE>'s on the value of the low word of <CODE>wParam</CODE>, which in the case of <CODE>WM_COMMAND</CODE>contains the control or menu id that sent the message.<P>We obviously want the Exit menu item to close the program.  So in the <CODE>WM_COMMAND</CODE>,<CODE>ID_FILE_EXIT</CODE> handler you can use the following code to do just that.<PRE CLASS="SNIP">PostMessage(hwnd, WM_CLOSE, 0, 0);</PRE><P>Your WM_COMMAND handler should now look like this:<PRE CLASS="SNIP">    case WM_COMMAND:        switch(LOWORD(wParam))        {            case ID_FILE_EXIT:                PostMessage(hwnd, WM_CLOSE, 0, 0);            break;            case ID_STUFF_GO:            break;        }    break;</PRE>I leave it up to you to make the other menu command <CODE>ID_STUFF_GO</CODE> do something.<H3>The program file icon</H3>You may have noticed that the <CODE>menu_one.exe</CODE> file now shows up as the custom icon we added as a resource, whereas the <CODE>menu_two.exe</CODE> file does not, since we are loading an external file.  WindowsExplorer simply displays the first icon (numerically by ID) in the program files resources, so since we only have one icon, that's what it is displaying.  If you want to be sure that a certainicon is displayed with your program file, simply add it as a resource and assign it a very low ID... like <CODE>1</CODE>.You don't even need to refer to the file in your program, and you can load completely different icons foryour windows if you choose.<HR><FONT SIZE="-1">Copyright &copy; 1998-2003, Brook Miles (<A HREF="mailto:forger(nospam)winprog.org">theForger</A>).  All rights reserved.</FONT><SCRIPT language="JavaScript"><!--   var re = /\(nospam\)/ig;   var str;   for(i = 0;i < document.links.length;i++)    {      str = "" + document.links(i).href;      if(str.search(re) != -1)         document.links(i).href = str.replace(re, "@");      str = "" + document.links(i).innerHTML;      if(str.search(re) != -1)         document.links(i).innerHTML = str.replace(re, "@");   }--></SCRIPT></BODY></HTML>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久影音资源网| 精品国产一区二区三区久久影院| 国产精品系列在线播放| 狠狠网亚洲精品| 精品无码三级在线观看视频| 日韩精品一二三四| 日韩黄色片在线观看| 日本三级韩国三级欧美三级| 视频一区视频二区中文| 蜜臀精品一区二区三区在线观看| 人人狠狠综合久久亚洲| 久久99精品久久久| 从欧美一区二区三区| 99精品视频在线播放观看| 欧洲生活片亚洲生活在线观看| 91国模大尺度私拍在线视频| 欧美日韩国产片| 欧美哺乳videos| 欧美激情艳妇裸体舞| 国产精品成人免费| 亚洲高清不卡在线观看| 精品系列免费在线观看| 91玉足脚交白嫩脚丫在线播放| 色菇凉天天综合网| 6080日韩午夜伦伦午夜伦| 欧美成人精品福利| 亚洲精品国产无天堂网2021| 日韩高清不卡一区二区三区| 国产精品一区2区| 在线观看视频一区二区欧美日韩| 欧美裸体一区二区三区| 国产亚洲欧美一级| 偷偷要91色婷婷| 成人手机在线视频| 欧美日韩亚洲另类| 国产精品美女www爽爽爽| 日韩成人一级片| www.激情成人| 久久天堂av综合合色蜜桃网| 亚洲黄色免费电影| 国产成人精品午夜视频免费| 欧美日韩精品一区二区天天拍小说| 久久久综合视频| 天天色天天操综合| 91视频国产资源| 久久蜜桃一区二区| 毛片av中文字幕一区二区| 91亚洲大成网污www| 久久亚洲影视婷婷| 精品一区二区三区影院在线午夜 | 制服.丝袜.亚洲.中文.综合| 国产亚洲综合性久久久影院| 丝袜亚洲另类欧美| 色婷婷亚洲一区二区三区| 久久久久久一级片| 看电视剧不卡顿的网站| 欧美亚洲动漫精品| 亚洲精品日韩综合观看成人91| 久久99国产精品成人| 欧美片网站yy| 亚洲18女电影在线观看| 91欧美激情一区二区三区成人| 国产日韩精品一区二区三区在线| 日本色综合中文字幕| 欧美日韩精品一区二区三区四区| 亚洲免费在线看| 成人精品一区二区三区四区| 国产亲近乱来精品视频| 国产一区不卡视频| 久久久午夜电影| 国产成人福利片| 国产精品污污网站在线观看| 高清不卡一区二区| 中文字幕不卡的av| eeuss鲁一区二区三区| 日本一区二区三区国色天香| 国产麻豆精品视频| 久久久久9999亚洲精品| 岛国精品一区二区| 亚洲图片另类小说| 色噜噜狠狠成人网p站| 夜色激情一区二区| 欧美精品久久99| 免费观看成人av| 久久久噜噜噜久久中文字幕色伊伊 | 日韩视频一区二区三区在线播放| 午夜电影网亚洲视频| 日韩美女一区二区三区四区| 蜜桃精品视频在线| 久久久久久久综合日本| www.日本不卡| 亚洲国产成人av好男人在线观看| 欧美吻胸吃奶大尺度电影| 日韩精品亚洲一区| 国产午夜一区二区三区| 一本色道久久综合亚洲aⅴ蜜桃 | 亚洲一区二区精品视频| 欧美日韩精品系列| 国产一区91精品张津瑜| 国产精品色呦呦| 欧美亚洲国产一区二区三区| 美女一区二区视频| 国产精品无圣光一区二区| 在线看一区二区| 国内国产精品久久| 亚洲精品国产一区二区精华液 | 亚洲三级在线免费观看| 欧美猛男男办公室激情| 国产美女视频91| 亚洲一级二级在线| 国产日韩v精品一区二区| 色中色一区二区| 国产主播一区二区| 亚洲国产精品麻豆| 欧美国产乱子伦 | 国产亲近乱来精品视频| 欧美午夜不卡视频| 丁香激情综合五月| 麻豆一区二区三区| 亚洲亚洲人成综合网络| 国产亚洲污的网站| 日韩精品专区在线| 欧美性xxxxxx少妇| 成人av在线资源| 韩国视频一区二区| 午夜不卡av免费| 一区二区在线观看视频| 国产欧美日韩中文久久| 欧美一区二区免费观在线| 一本色道久久综合亚洲aⅴ蜜桃| 国产一区三区三区| 久久国产精品区| 五月天激情综合| 亚洲成国产人片在线观看| 中文字幕一区二区三区在线观看| 日韩免费视频线观看| 欧美美女喷水视频| 欧美日韩和欧美的一区二区| a级精品国产片在线观看| 国产精品一区二区无线| 国产一区二区伦理片| 日本午夜一区二区| 视频一区二区三区在线| 亚洲成av人片| 天堂久久一区二区三区| 亚洲大片精品永久免费| 亚洲国产精品综合小说图片区| 亚洲视频网在线直播| 亚洲三级小视频| 亚洲免费三区一区二区| 亚洲毛片av在线| 亚洲综合激情网| 亚洲成av人片| 麻豆精品国产传媒mv男同 | 欧美国产精品一区| 国产欧美精品国产国产专区| 久久欧美中文字幕| 国产亚洲一区二区三区在线观看| 国产午夜精品久久久久久久 | 成人一区在线看| 丁香婷婷综合激情五月色| 国产精华液一区二区三区| 国产不卡在线播放| av不卡免费电影| 在线免费观看不卡av| 666欧美在线视频| 欧美大白屁股肥臀xxxxxx| 精品盗摄一区二区三区| 国产精品嫩草影院av蜜臀| 一区二区中文视频| 亚洲国产精品久久久男人的天堂| 亚洲一区二区黄色| 国产做a爰片久久毛片| 成人免费观看视频| 色婷婷久久一区二区三区麻豆| 欧美日韩精品欧美日韩精品一综合| 欧美高清精品3d| 欧美国产1区2区| 亚洲福利电影网| 精品一区二区三区免费| 99精品国产91久久久久久 | 精品久久五月天| 国产精品电影院| 日韩激情一二三区| av亚洲产国偷v产偷v自拍| 欧美精品aⅴ在线视频| 久久久久久久久岛国免费| 一区二区三区日韩欧美| 国内成人自拍视频| 精品视频在线视频| 久久夜色精品一区| 天天影视涩香欲综合网| 成人免费视频一区二区| 欧美乱妇一区二区三区不卡视频| 久久精品欧美一区二区三区不卡| 亚洲国产精品一区二区尤物区| 国产伦精品一区二区三区免费迷| 色噜噜狠狠色综合欧洲selulu| 久久久久久电影| 奇米综合一区二区三区精品视频|