win32姒傝堪
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了win32姒傝堪相关的知识,希望对你有一定的参考价值。
鏍囩锛?a href='http://www.mamicode.com/so/1/getch' title='getch'>getch incr 瀹炵幇 startup 缁熶竴 鏀鹃煶 main 瀹氫箟 鍋氫簡
win32鍩轰簬宸叉湁鐨勬鏋?鏈夋剰鍏ュ彛鍑芥暟鍙湁涓€涓?/p>
閮介渶瑕佹湁涓€涓富鍑芥暟 鎵€鏈夌▼搴忕殑鍏ュ彛閮芥槸maincrtstartup
tydedef 椤惧悕鎬濅箟
window鏄熀浜巆,c++ 鍙堟兂鏈夎嚜宸辨墍鐗规湁鐨勬暟鎹被鍨?鎵€浠ュ湪C锛孋++鐨勭被鍨嬪熀纭€涓婂仛浜嗛噸瀹氫箟
1.鍖哄埆c璇█娌℃湁椤惧悕鎬濅箟
2.灏佽淇℃伅
鐗规€?锛?br />1.濡傛灉娌℃湁璁茶繃 鍏堣浆瀹氫箟鐪嬬被鍨?br />2.澶у啓H寮€澶?鍦╳in32閲岄潰璁插彞鏌?br />3.LP,P寮€澶村湪win32閲岄潰琛ㄧず鎸囬拡
4.windows閲岄潰鏁版嵁绫诲瀷鍏ㄩ兘鏄ぇ鍐?浣嗗悓鏃秝indows鏄熀浜嶤锛孋++鐨勬暟鎹被鍨?/p>
绋嬪簭涓袱绉嶅瓧绗﹂泦鐨勮〃鐜?澶氬瓧鑺傚拰瀹藉瓧鑺?浠ュ強閫氶厤瀛楃闆?/p>
window娌℃湁闊充箰鎾斁 鍙槸瀹夎浜嗕竴涓粯璁ょ殑闊充箰鎾斁鍣?/p>
瀛︿細杩愮敤windows缂栫▼ 缂栧啓鎾斁闊充箰
浠ヤ笂浠g爜濡備笅瀹炵幇
1 //閫昏緫閮ㄥ垎 鏄惧紡閮ㄥ垎 2 #include<Windows.h> 3 #pragma comment(lib,"Winmm.lib")//搴撴枃浠?鍔ㄦ€佸簱鎴栭潤鎬佸簱 4 //windows鐨勫叆鍙e嚱鏁?WinMain 5 int WinMain(_In_ HINSTANCE hInstance,//搴旂敤绋嬪簭浣跨敤鍙ユ焺 6 _In_opt_ HINSTANCE hPrevInstance,//鐖跺簲鐢ㄧ▼搴忓疄渚嬪彞鏌勶紙鐜扮増鏈负null锛?/span> 7 _In_ LPSTR lpCmdLine,//鍛戒护琛屽弬鏁?/span> 8 _In_ int nShowCmd)//绐楀彛鏄剧ず鏂瑰紡 9 10 MessageBoxA(nullptr,//绐楀彛鍙ユ焺 11 "abc",//娑堟伅鐩掑瓙鏂囨湰鍐呭 12 "123",//娑堟伅鐩掑瓙鏍囬 13 MB_YESNOCANCEL|MB_ICONWARNING//娑堟伅鐩掑瓙鐨勭被鍨? 14 ); 15 //windows鏄熀浜巆璇█c++鐨勫張鎯虫湁鑷繁鐨勬暟鎹被鍨?鎵€浠ュ湪c/c++鍩虹涓婂仛浜嗗啿瀹氫箟 16 //澶氬瓧鑺?/span> 17 char c = 鈥?/span>a鈥?/span>; 18 char *pc = "abc";//澶氬瓧鑺傚瓧绗︿覆 19 //pc = &c; 20 int m = strlen(pc);//澶氬瓧鑺傛眰闀垮害 21 //瀹藉瓧鑺?/span> 22 wchar_t wc = 鈥?/span>a鈥?/span>;//瀹藉瓧鑺傚瓧绗?/span> 23 wchar_t *pwc = L"ABCD";//瀹藉瓧鑺傚瓧绗︿覆 24 m = wcslen(pwc);//瀹藉瓧鑺傛眰闀垮害 25 //閫氶厤瀛楃闆嗚〃鐜?/span> 26 TCHAR tc = 鈥?/span>a鈥?/span>;//鍙互鏍规嵁鑷繁鐨勯渶姹傛敼鍙樺瓧鑺傜被鍨?/span> 27 TCHAR *ptc = _T("abc");//_T()甯﹀弬瀹?/span> 28 _tcslen(ptc); 29 //1.鍙互涓嶇椤圭洰涓娇鐢ㄧ殑瀛楃闆?鍙互鑷璁惧畾鍥哄畾鐨勭被鍨嬪幓琛ㄧ幇瀛楃鎴栬€呭瓧绗︿覆锛宑har鎴杦char_t 30 //2.鍙互缁熶竴浣跨敤瀛楃鐨勯€氶厤绫诲瀷 31 //wav闊充箰鎾斁 32 PlaySound(_T(""),//鏂囦欢璺緞鍚嶏紝鐩稿璺緞 33 nullptr,//搴旂敤绋嬪簭瀹炲垪鍙ユ焺 34 SND_LOOP | SND_FILENAME | SND_ASYNC//鏂囦欢鎿嶄綔妯″紡 35 //SND_LOOP 寰幆 SND_FILENAME 鎸囧畾鏂囦欢 SND_ASYNC 寮傛 36 ); 37 //mp3闊充箰鎾斁 38 mciSendString(_T("....mp3 alias abc"),//鎵撳紑涓€涓?.mp3鐨勬枃浠?alias鍙栧埆鍚嶅彨abc 39 nullptr,//鎺ュ彈淇℃伅鐨勭紦瀛樺尯锛宯ull琛ㄧず涓嶆帴鍙椾俊鎭?/span> 40 0,//绗簩涓弬鏁扮殑鍐呭瓨澶у皬 41 nullptr);//鍥炶皟鍑芥暟鐨勭獥鍙e彞鏌?/span> 42 mciSendString(_T("play abc"), 0, 0, 0); 43 MessageBox(0, 0, 0, 0);//绫讳技浜巊etchar()鍥犱负windows缂栫▼閲屼笉鑳界敤 44 45 return 0; 46
以上是关于win32姒傝堪的主要内容,如果未能解决你的问题,请参考以下文章