c++:無法載入menu

看板Programming作者時間18年前 (2007/08/22 06:01), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
請教一下,我參考過網路上介紹c++的網頁: http://www.functionx.com/win32/Lesson07.htm http://itzone.hk/article/article.php?aid=200406211205229426 http://www.cs.binghamton.edu/~reckert/360/class2a.htm 但是我的程式內仍無法加入我做的menu選單, 我將我的程式碼放在以下的位置: http://rapidshare.com/files/50420191/abcTest.zip 如果各位大大時間上允許,麻煩請幫我看看,指點一下是哪裡出了問題。 以下將附上我的語法: resource.rc //Microsoft Developer Studio generated resource script. // #include "resource.h" #define APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 2 resource. // #include "afxres.h" ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // Chinese (Taiwan) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHT) #ifdef _WIN32 LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL #pragma code_page(950) #endif //_WIN32 #ifdef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // TEXTINCLUDE // 1 TEXTINCLUDE DISCARDABLE BEGIN "resource.h\0" END 2 TEXTINCLUDE DISCARDABLE BEGIN "#include ""afxres.h""\r\n" "\0" END 3 TEXTINCLUDE DISCARDABLE BEGIN "\r\n" "\0" END #endif // APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // Menu // IDR_MENU1 MENU DISCARDABLE BEGIN MENUITEM "&File", ID_MENU_FILE MENUITEM "&About", ID_MENU_ABOUT MENUITEM SEPARATOR MENUITEM "&Exit", ID_MENU_EXIT END #endif // Chinese (Taiwan) resources ///////////////////////////////////////////////////////////////////////////// #ifndef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 3 resource. // ///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED resource.h //{{NO_DEPENDENCIES}} // Microsoft Developer Studio generated include file. // Used by resource.rc // #define IDR_MENU1 101 #define ID_MENU_FILE 40001 #define ID_MENU_ABOUT 40002 #define ID_MENU_EXIT 40003 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 102 #define _APS_NEXT_COMMAND_VALUE 40004 #define _APS_NEXT_CONTROL_VALUE 1000 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif winMain.cpp #include<windows.h> #include "resource.h" LRESULT CALLBACK WindowsProcedure(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lP aram); int WINAPI WinMain( HINSTANCE hInstance , HINSTANCE hPrevInstance, LPSTR lpCmdLi ne , int ShowCmd) { char szAppName[] = "My first VC++ program"; HWND hwnd; MSG msg; WNDCLASSEX wndclass; wndclass.cbSize = sizeof(wndclass); wndclass.style = CS_HREDRAW | CS_VREDRAW; wndclass.cbClsExtra = 0; wndclass.cbWndExtra = 0; wndclass.lpfnWndProc = WindowsProcedure; wndclass.hInstance = hInstance; wndclass.hIcon = LoadIcon(NULL , IDI_HAND); wndclass.hCursor = LoadCursor(NULL , IDC_ARROW); wndclass.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wndclass.hIconSm = LoadIcon(NULL , IDI_APPLICATION); wndclass.lpszClassName = szAppName; wndclass.lpszMenuName = MAKEINTRESOURCE(IDR_MENU1); RegisterClassEx( &wndclass); hwnd = CreateWindow(szAppName , "My First VC++ program" , WS_OVERLAPPEDWINDOW , CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL); ShowWindow(hwnd , ShowCmd); UpdateWindow(hwnd); while( GetMessage(&msg , 0 , 0 , 0) ) { TranslateMessage( &msg ); DispatchMessage( &msg ); } UnregisterClass( szAppName , hInstance ); return msg.wParam; } LRESULT CALLBACK WindowsProcedure(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lP aram) { switch(iMsg) { case WM_DESTROY: PostQuitMessage(0); return 0; } return DefWindowProc(hWnd, iMsg, wParam, lParam); } 謝謝! -- ┌─────KKCITY─────┐KKMAN團隊 全新力作 ◎◎KKBOX◎◎ bbs.kkcity.com.tw 知名歌手通通都有 所有新歌想聽就聽 └──From:218.169.108.58 ──┘※※ 內容豐富多元的線上音樂台 ※※ --
文章代碼(AID): #16os2U00 (Programming)
文章代碼(AID): #16os2U00 (Programming)