定義一個復數類Complex,使得下面的代碼能夠工作 Complex c1(3,5); // 用復數3+5i初始化c1 Complex c2 = 4.5; // 用實參4.5初始化c2 c1.add(c2); // 將c1與c2相加,結果保存在c1中 c1.show(); // 將c1輸出(這時結果應該是7.5+5i)
上傳時間: 2016-05-17
上傳用戶:拉梅系數
[開源 綠色軟件] [運行環境 Windows XP/7/8/10] [語言 簡體/繁體/English/Unicode] A cool music player. Powered by Bass and BassVis. 極簡本地音樂播放器,透明、純文本界面。支持輕媒體庫、歌詞、可視化。最小化到托盤,占用資源少,適合邊聽音樂邊工作。 應網友要求,加入了Tag編輯、自動切換列表、播放隊列、鼠標手勢、均衡器、音頻設備選擇、全局音量滾輪(托盤區域)、字體設置、極簡模式、鼠標穿透、嵌入桌面、簡單布局等功能。 homepage> mcool.appinn.me ==================================================== 音頻格式APE、FLAC、WavPack、MP3、OGG、TTA、TAK、Musepack、AAC、AC3、WMA、Wav、CD、ALAC、Aiff、MOD、CUE ==================================================== 更新歷史: 3336 -2016.3.25 點睛之筆:任意布局(追上foobar2000)。Arbitrary layout (all in one). 3330 -2016.3.10 一體布局之比例調節(初具foobar2000風貌)。Ratio adjust (all in one). 3308 -2015.11.28 歌詞微調(在選項>常規>鼠標手勢里設置)。Adds function of lyrics tuning. 3306 -2015.11.15 電臺模式(整點時切換歌曲或列表,并非在線音樂),以及多聲卡支持。Adds radio mode, and multi sound card support. 3300 -2015.10.15 完善細節,修復切歌卡住bug。完美版。Fixes some bugs. 3280 -2015.8.1 簡單布局功能。Layout (all in one) function. 3260 -2015.6.1 Win10模式。Win10 mode. 3252 -2015.5.10 任務欄進度條。Taskbar progress display. 3236 -2015.4.10 點睛之筆:透明度調節。Adds function of transparency tuning. 3232 -2015.3.25 自定義軟件名(請在mcool.ini中手動修改)。Adds function of customizing app name. 3230 -2015.3.12 Airplay復刻界面。Airplay interface copy. 3218 -2015.1.20 桌面歌詞。Desktop lyrics. 3216 -2015.1.12 一體化界面(學習Foobar2000和豆瓣FM)。All in one interface. 3212 -2015.1.6 新增Winamp音效插件支持(學習千千靜聽),以及滾輪穿透功能(學習Airplay3)。Adds Winamp DSP plugins support, and adds function of wheel transparent. Winamp音效插件下載:http://uploadgeneration.info/Winamp/www.winamp.com/plugins/dsp-effect/5/top-rated.html 3210 -2014.12.28 重要更新:本地音量調節、自定義鼠標鍵/手勢。Adds local volume control, and adds fuction of customizing mouse control / gesture. 3208 -2014.11.25 簡化右鍵菜單,常規項目移到選項窗口。Simplifies the popup menu, moves the general items to option window. 3206 -2014.11.22 新增文本對齊選項,重新設計導航按鈕。Adds option of text alignment, and redesigns the buttons of playback. 3202 -2014.11.10 新增播放記憶、片段循環(Hotkey: Ctrl+1/2)和貼邊隱藏功能。Adds functions of playback memory, AB repeat and screen side hide. 3200 -2014.11.5 新增無界面選項(先去掉托盤圖標,然后Ctrl+Alt+W隱藏界面,Ctrl+Alt+X關閉)。Adds option of no interface. 3191 -2014.8.26 嵌入桌面。Pins to desktop. 3190 -2014.8.19 音樂管理第一步:列表分組。Playlists grouping. 3186 -2014.8.10 基于列表的分級系統(Hotkey:0..5)。Rating system based on playlist. 3181 -2014.8.1 啟用新圖標(由虹吸墨作者BGLL友情制作)。Uses the new icon. 3180 -2014.7.22 新增Win7任務欄特效。Adds windows 7 taskbar effect. 3166 -2014.6.29 重要更新:自動下載專輯封面(源于歌詞迷)。Downloads album covers from geci.me. 3160 -2014.6.1 重要更新:新增極簡模式,以及OGG/Opus內置封面顯示功能。Adds minimalist mode, and adds function of displaying cover embedded in OGG/Opus. 3152 -2014.5.18 添加托盤右鍵菜單,新增MP4/M4A(ALAC)內置封面顯示功能。Adds systray popup menu, and adds function of displaying cover embedded in MP4/M4A(ALAC). 3151 -2014.5.1 重新設計可視化效果,新增示波器效果。Redesigns visual effects, and adds oscilloscope effect. 3150 -2014.4.20 采用歌詞迷API下載歌詞。Downloads lyrics from geci.me. 3136 -2014.3.30 加入可選的按鈕,以及鼠標穿透功能。Adds function of transparent window. 3132 -2014.3.6 簡化界面,向Foobar2K看齊;增加正在播放面板。Simplifies the interface, and adds now playing panel. 3130 -2014.2.26 重要更新:按照專輯分組。Grouping by album. 3120 -2014.2.18 優化字體渲染(Windows7/8下)。Optimizes font rendering in Windows 7/8. 3110 -2014.1.26 點睛之筆:自定義字體顏色。Adds function of customizing font color. 3108 -2013.11.16 Last.fm同步功能(請到主頁下載插件)。Last.fm scrobbler support. 3106 -2013.11.8 可回溯的隨機播放(學習Airplay 2)。Random playback can be traced back. 3103 -2013.10.12 優化右鍵菜單。Optimizes popup menu. 3102 -2013.9.30 修改滾動條樣式,增加音頻緩沖選項。Modifies style of scroll bar, and adds option of audio buffer length. 3100 -2013.9.10 無邊框設計;迷你模式也可以不置頂(Hotkey:T)。Borderless designs. 3086 -2013.8.20 增加歌詞面板功能。Adds function of lyrics panel. 3082 -2013.8.08 增加在可視化界面顯示歌詞功能。Adds function of displaying lyrics on visual interface. 3080 -2013.8.01 新增設置字體功能,恢復簡單的自動關機功能。Adds function of setting font, and re-adds simple function of auto shutdown. 3060 -2013.6.26 修復在迷你模式停止響應的Bug,去掉自動關機、歌詞調整功能。Fixes bug of stop responding in mini mode, and removes functions of auto shutdown and lyrics trimming. 3050 -2013.5.23 增加手勢功能。Adds gesture function. 3030 -2013.3.10 增加Aero磨砂玻璃效果[如需源碼請聯系我],XP/Win7/8無差別顯示,按Insert鍵開啟。Adds aero glass effect. 3020 -2013.2.23 增加簡易Tag編輯功能(選中并單擊即可,相當于資源管理器中的重命名,按照[歌手 - 歌名][專輯]格式進行編輯)。Adds function of editing audio tags (select and click, edit with [artist - title][album] format). 3010 -2013.1.23 應網友要求,加入讀取內嵌CUE、歌詞及專輯封面功能。Adds function of reading CUE, LRC and album cover built in media. 3002 -2012.11.03 無按鈕設計;微調進度條尺寸。Buttonless design; modifies the size of the progress bar. 3001 -2012.10.15 重要改進,界面即按鈕:單擊 - 播放/暫停,按住 - 前進。Important update, the interface is a button: Click - Play/Pause, Hold Down - Next. 3000 -2012.9.28 增加Win8模式。Adds Win8 mode option. 2982 -2012.8.26 在Win8下使用微軟雅黑字體。Uses Microsoft YaHei font in Windows 8 CHS. 2981 -2012.8.20 視頻以插件提供(請到主頁下載),增加單曲循環功能。Adds function of repeat track. 2980 -2012.7.26 簡化代碼,去掉視頻和MIDI支持。Removes the video and MIDI support. 2970 -2012.7.20 增加媒體信息顯示功能。Adds function of displaying media info. 2960 -2012.6.28 增加專輯封面顯示功能(Hotkey:Ins)。Adds function of displaying album cover. 2956 -2012.6.01 再次簡化界面。Simplifies the interface again. 2952 -2012.4.28 增加音頻設備選擇功能:DS、ASIO、WASAPI。Adds function of selecting playback device. 2950 -2012.3.30 *增加滾輪調節音量功能(在托盤,中鍵靜音)和媒體鍵支持。Adds function of setting volume by mouse wheel (over systray, middle click to mute), and adds multimedia keys support. 2936 -2012.3.17 微調界面,修復物理刪除失效的BUG。Fine-tunes the interface, and restores the physical delete function. 2930 -2012.2.27 增加TAK格式支持。Adds TAK format support. 2923 -2012.2.12 緊急修復上一版出現的字體模糊BUG(Vista/Win7下),增加在任務欄顯/隱圖標功能(Ctrl+T)。Fixes font vague bug for Vista/Win7, and adds showing/hiding icon on taskbar function. 2920 -2012.2.08 微調界面,優化CPU占用(啟用背景圖片時)。Fine-tunes the interface, and optimizes CPU utilization (while enable background image). 2912 -2012.1.12 增加播放隊列功能。Adds playback queue function. 2910 -2011.12.25 改進迷你模式,增加查找功能。Improves mini mode, and adds find function. *注:此功能對殺毒軟件過敏,開啟方法:按F1進入選項,勾選全局快捷鍵。The feature is allergic to the anti-virus software.
上傳時間: 2016-06-10
上傳用戶:fanghua
altium15安裝與破解 1.運行AD15KeyGen,點擊“打開模板”,加載license.ini,如想修改注冊名,只需修改: TransactorName=Your Name 其中Your Name用你自己的名字替換,其它參數在單機版的情況下無需修改; 2.點擊“生成協議”,保存生成的alf文件(文件名任意,如“jack ”),并將其放到你的安裝目錄下; 3.將patch.exe放到你的安裝目錄下,運行patch,對安裝目錄下的dxp.exe文件補丁,注意運行破解時軟件沒有運行; 4.啟動DXP,運行菜單DXP->My Account,點擊Add Standalone License file,加載前面生成的license(.alf)文件后即能正常使用了。 注意: 1.局域網內用同一license不再提示沖突 2.僅供學習研究使用,勿用于非法用途。
上傳時間: 2016-06-11
上傳用戶:newvision
如何處理pcb轉換時的一些問題,如果出現unknown Pin和failed to add class member等問題的詳細介紹
標簽: pcb
上傳時間: 2016-07-28
上傳用戶:斷點PPpp
樓術描述項: (1).該項目中"我的電腦"是作者自定義的root節點,沒有設定其路徑,所以BeforeExpand事件中會從它開始依次遍歷,但"我的電腦"會提示"沒有指定路徑".故需要if(e.Tag.ToString() != "我的電腦")判斷.同時"我的文檔"需要再次獲取其路徑,依次實現Add子節點; (2).同時在"我的文檔"和盤符中需要添加tNode.Nodes.Add("")加載空節點形成+號,如果沒有該+號,BeforeExpend事件不會被調用,子目錄無法獲取加載,在BeforeExpand事件調用TreeViewItems.Add加載其子結點需要e.Nodes.Clear();清除該結點的子目錄再加載. (3).提供兩篇類似文章供大家學習,經過對比可以發現:第一篇僅從驅動器(C盤)開始加載,所以BeforeExpend簡單展開子目錄即可,不需要判斷"我的電腦"和"我的文檔".第二篇含"桌面",因此需要判斷路徑:"C# TreeView磁盤文件,AfterSelect顯示加號-駱駝祥子" 和"Treeview樹狀顯示文件夾" .同時補充一篇很優秀的文章供大家學習"WinForm應用:ListView做圖像瀏覽" (4).補充TreeView(樹視圖)事件:更詳細見"c# 樹狀視圖(TreeView類)". 事件 描述 AfterCheck 在選中節點復選框后引發 AfterCollapse 在折疊一個節點后引發 AfterExpand 在擴展一個節點后引發 AfterSelect 在選中一個節點后引發 BeforeCheck 在選中節點復選框之前引發 BeforeCollapse 在折疊一個節點之前引發 BeforeExpand 在擴展一個節點之前引發 BeforeSelect 在選中一個節點之前引發 (5).補充兩個關于論壇討論"c#怎樣動態讀取資源文件里的圖片"和"在C#中怎么調用Resources文件中的圖片" (6).在《C#典型模塊與項目實戰大全》(清華大學出版社-丁士鋒)書中談到,出于對程序響應性能考慮,它先加載盤符結點,沒有使用遞歸一次性加載所有文件到樹狀列表中,代碼通過AfterSelect事件和FileSystemWatcher控件,監聽加載.并使用線程池Task更新加載TreeView,希望大家去學習. 總結 該篇通過TreeView加載了磁盤目錄路徑,并通過ImageList加載圖標.那么怎樣實現閱讀文件夾下文件,獲取其圖標、文件大小、擴展名等信息,并雙擊打開文件呢?下一篇將接著講述.最后希望該文章對大家有所幫助,文章中很多鏈接都可以供覺得有用的同學學習,感謝上面提到的文章及書籍作者.同時如果文章中有錯誤或不足之處請原諒,有問題或建議者亦可提出.希望尊重作者勞動果實勿噴.
上傳時間: 2016-08-15
上傳用戶:baobao9437
實驗內容: 1.利用QuartusII的"MegaWizard Plug-In Manager", 設計輸入數據寬度是4bit的ADD、SUB、MULT、DIVIDE、COMPARE 把它們作為一個project,DEVICE選用EPF10K70RC240-4,對它們進行 時序仿真,將仿真波形(輸入輸出選用group)文件提交。 2.利用QuartusII的"MegaWizard Plug-In Manager"中的LPM_COUNTER, 設計一個20bit的up_only COUNTER, 要求該COUNTER在FE0FA和FFFFF之間自動循環計數; 分析該COUNTER在EPM7128SLC84-7、EPM7128SLC84-10、 和EPF10K70RC240-2、EPF10K70RC240-4幾種芯片中的最大工作頻率; 請將計數器的輸出仿真波形文件提交(特別注意在0FFFFCH--0FE0FFH之間的仿真波形圖)。 (僅EPF10K70RC240-4芯片,最大允許Clock頻率下)。
標簽: 實驗
上傳時間: 2016-10-18
上傳用戶:jack
#include "string.h" #include "ctype.h" #include "stdio.h" search(char pd[]) {FILE *fp; int time=0,i=0,j=0,add[80],k=0,m; char *ch, str[900]; m=strlen(pd); if((fp=fopen("haha.txt","r"))==NULL) { printf("Cannot open this file\n"); exit(0); } for(;!feof(fp);i++) { str[i]=fgetc(fp); if(tolower(str[i])==tolower(pd[k])) {k++; if(k==m) if(!isalpha(i-m)&&!isalpha((str[i++]=fgetc(fp)))) { time++; add[j]=i-m+1; j++; k=0; } else k=0; } } if(time) { printf("The time is:%d\n",time); printf("The adders is:\n"); for(i=0;i
標簽: 查詢學會少年宮
上傳時間: 2016-12-29
上傳用戶:767483511
#include "string.h" #include "ctype.h" #include "stdio.h" search(char pd[]) {FILE *fp; int time=0,i=0,j=0,add[80],k=0,m; char *ch, str[900]; m=strlen(pd); if((fp=fopen("haha.txt","r"))==NULL) { printf("Cannot open this file\n"); exit(0); } for(;!feof(fp);i++) { str[i]=fgetc(fp); if(tolower(str[i])==tolower(pd[k])) {k++; if(k==m) if(!isalpha(i-m)&&!isalpha((str[i++]=fgetc(fp)))) { time++; add[j]=i-m+1; j++; k=0; } else k=0; } } if(time) { printf("The time is:%d\n",time); printf("The adders is:\n"); for(i=0;i<j;i++) printf("%5d",add[i]); if(i%5==0) printf("\n"); getch(); fclose(fp); } else printf("Sorry!Cannot find the word(^_^)"); } main() { char pd[10],choose='y'; int flag=1; while(flag) {printf("In put the word you want to seqarch:"); scanf("%s",pd); search(strlwr(pd)); printf("\nWould you want to continue?(Y/N):"); getchar(); scanf("%c",&choose); if((tolower(choose))=='n') flag=0; else flag=1; } printf("Thanks for your using!Bye-bye!\n"); getch(); }
標簽: 學生專用
上傳時間: 2016-12-29
上傳用戶:767483511
// 學生管理.cpp : Defines the entry point for the application. // #include "stdafx.h" #include "resource.h" #define MAX_LOADSTRING 100 // Global Variables: HINSTANCE hInst; // current instance TCHAR szTitle[MAX_LOADSTRING]; // The title bar text TCHAR szWindowClass[MAX_LOADSTRING]; // The title bar text // Foward declarations of functions included in this code module: ATOM MyRegisterClass(HINSTANCE hInstance); BOOL InitInstance(HINSTANCE, int); LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); LRESULT CALLBACK About(HWND, UINT, WPARAM, LPARAM); struct person { char name[10]; int ID; int cj_yw; int cj_sx; struct person* next; struct person* pro; }per; int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { // TODO: Place code here. MSG msg; HACCEL hAccelTable; // Initialize global strings LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); LoadString(hInstance, IDC_MY, szWindowClass, MAX_LOADSTRING); MyRegisterClass(hInstance); // Perform application initialization: if (!InitInstance (hInstance, nCmdShow)) { return FALSE; } hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_MY); // Main message loop: while (GetMessage(&msg, NULL, 0, 0)) { if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } return msg.wParam; } // // FUNCTION: MyRegisterClass() // // PURPOSE: Registers the window class. // // COMMENTS: // // This function and its usage is only necessary if you want this code // to be compatible with Win32 systems prior to the 'RegisterClassEx' // function that was added to Windows 95. It is important to call this function // so that the application will get 'well formed' small icons associated // with it. // ATOM MyRegisterClass(HINSTANCE hInstance) { WNDCLASSEX wcex; wcex.cbSize = sizeof(WNDCLASSEX); wcex.style = CS_HREDRAW | CS_VREDRAW; wcex.lpfnWndProc = (WNDPROC)WndProc; wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; wcex.hInstance = hInstance; wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_MY); wcex.hCursor = LoadCursor(NULL, IDC_ARROW); wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wcex.lpszMenuName = (LPCSTR)IDC_MY; wcex.lpszClassName = szWindowClass; wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL); return RegisterClassEx(&wcex); } // // FUNCTION: InitInstance(HANDLE, int) // // PURPOSE: Saves instance handle and creates main window // // COMMENTS: // // In this function, we save the instance handle in a global variable and // create and display the main program window. // BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) { HWND hWnd; hInst = hInstance; // Store instance handle in our global variable hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL); if (!hWnd) { return FALSE; } ShowWindow(hWnd, nCmdShow); UpdateWindow(hWnd); return TRUE; } // // FUNCTION: WndProc(HWND, unsigned, WORD, LONG) // // PURPOSE: Processes messages for the main window. // // WM_COMMAND - process the application menu // WM_PAINT - Paint the main window // WM_DESTROY - post a quit message and return // // LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int wmId, wmEvent; PAINTSTRUCT ps; HDC hdc; TCHAR szHello[MAX_LOADSTRING]; LoadString(hInst, IDS_HELLO, szHello, MAX_LOADSTRING); switch (message) { case WM_COMMAND: wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); // Parse the menu selections: switch (wmId) { case IDM_ABOUT: DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About); break; case IDM_EXIT: DestroyWindow(hWnd); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } break; case WM_PAINT: hdc = BeginPaint(hWnd, &ps); // TODO: Add any drawing code here... RECT rt; GetClientRect(hWnd, &rt); DrawText(hdc, szHello, strlen(szHello), &rt, DT_CENTER); EndPaint(hWnd, &ps); break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; } // Mesage handler for about box. LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_INITDIALOG: return TRUE; case WM_COMMAND: if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) { EndDialog(hDlg, LOWORD(wParam)); return TRUE; } break; } return FALSE; }
上傳時間: 2016-12-29
上傳用戶:767483511
// 學生管理.cpp : Defines the entry point for the application. // #include "stdafx.h" #include "resource.h" #define MAX_LOADSTRING 100 // Global Variables: HINSTANCE hInst; // current instance TCHAR szTitle[MAX_LOADSTRING]; // The title bar text TCHAR szWindowClass[MAX_LOADSTRING]; // The title bar text // Foward declarations of functions included in this code module: ATOM MyRegisterClass(HINSTANCE hInstance); BOOL InitInstance(HINSTANCE, int); LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); LRESULT CALLBACK About(HWND, UINT, WPARAM, LPARAM); struct person { char name[10]; int ID; int cj_yw; int cj_sx; struct person* next; struct person* pro; }per; int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { // TODO: Place code here. MSG msg; HACCEL hAccelTable; // Initialize global strings LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); LoadString(hInstance, IDC_MY, szWindowClass, MAX_LOADSTRING); MyRegisterClass(hInstance); // Perform application initialization: if (!InitInstance (hInstance, nCmdShow)) { return FALSE; } hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_MY); // Main message loop: while (GetMessage(&msg, NULL, 0, 0)) { if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } return msg.wParam; } // // FUNCTION: MyRegisterClass() // // PURPOSE: Registers the window class. // // COMMENTS: // // This function and its usage is only necessary if you want this code // to be compatible with Win32 systems prior to the 'RegisterClassEx' // function that was added to Windows 95. It is important to call this function // so that the application will get 'well formed' small icons associated // with it. // ATOM MyRegisterClass(HINSTANCE hInstance) { WNDCLASSEX wcex; wcex.cbSize = sizeof(WNDCLASSEX); wcex.style = CS_HREDRAW | CS_VREDRAW; wcex.lpfnWndProc = (WNDPROC)WndProc; wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; wcex.hInstance = hInstance; wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_MY); wcex.hCursor = LoadCursor(NULL, IDC_ARROW); wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wcex.lpszMenuName = (LPCSTR)IDC_MY; wcex.lpszClassName = szWindowClass; wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL); return RegisterClassEx(&wcex); } // // FUNCTION: InitInstance(HANDLE, int) // // PURPOSE: Saves instance handle and creates main window // // COMMENTS: // // In this function, we save the instance handle in a global variable and // create and display the main program window. // BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) { HWND hWnd; hInst = hInstance; // Store instance handle in our global variable hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL); if (!hWnd) { return FALSE; } ShowWindow(hWnd, nCmdShow); UpdateWindow(hWnd); return TRUE; } // // FUNCTION: WndProc(HWND, unsigned, WORD, LONG) // // PURPOSE: Processes messages for the main window. // // WM_COMMAND - process the application menu // WM_PAINT - Paint the main window // WM_DESTROY - post a quit message and return // // LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int wmId, wmEvent; PAINTSTRUCT ps; HDC hdc; TCHAR szHello[MAX_LOADSTRING]; LoadString(hInst, IDS_HELLO, szHello, MAX_LOADSTRING); switch (message) { case WM_COMMAND: wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); // Parse the menu selections: switch (wmId) { case IDM_ABOUT: DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About); break; case IDM_EXIT: DestroyWindow(hWnd); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } break; case WM_PAINT: hdc = BeginPaint(hWnd, &ps); // TODO: Add any drawing code here... RECT rt; GetClientRect(hWnd, &rt); DrawText(hdc, szHello, strlen(szHello), &rt, DT_CENTER); EndPaint(hWnd, &ps); break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; } // Mesage handler for about box. LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_INITDIALOG: return TRUE; case WM_COMMAND: if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) { EndDialog(hDlg, LOWORD(wParam)); return TRUE; } break; } return FALSE; }
標簽: 學生 計算器
上傳時間: 2016-12-29
上傳用戶:767483511