[帮忙]用C学windows98编程时下面程序遇见fatal error RC1004
用C学windows98编程时下面程序遇见fatal error RC1004: unexpected end of file foundError executing rc.exe.
Menu.h的内容//应该就是这里出问题了。
#define IDM_ALPHA 100
#define IDM_BETA 101
#define IDM_EXIT 102
#define IDM_GAMMA 103
#define IDM_DELTA 104
#define IDM_EPSILON 105
#define IDM_ZETA 106
#define IDM_ETA 107
#define IDM_THETA 108
#define IDM_HELP 109
/*===========================================================*/
Menu.c的内容:
#include<windows.h>
#include"menu.h"
LRESULT CALLBACK WindowFunc(HWND, UINT, WPARAM, LPARAM);
char szWinName[]="My Win";
int WINAPI WinMain(HINSTANCE hThisInst, HINSTANCE hPrevInst, LPSTR lpszArgs, int nWinMode)
{
HWND hwnd;
MSG msg;
WNDCLASSEX wcl;
//define a window class
wcl.cbSize=sizeof(WNDCLASSEX);
wcl.hInstance=hThisInst;
wcl.lpszClassName=szWinName;
wcl.lpfnWndProc=WindowFunc;
wcl.style=0;
wcl.hIcon=LoadIcon(NULL, IDI_APPLICATION);
wcl.hIconSm=LoadIcon(NULL, IDI_WINLOGO);
wcl.hCursor=LoadCursor(NULL, IDC_ARROW);
wcl.lpszMenuName="My Menu"; //main menu
wcl.cbClsExtra=0;
wcl.cbWndExtra=0;
wcl.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
if(!RegisterClassEx(&wcl)) return 0;
//create the window
hwnd=CreateWindow(
szWinName,
"Using Menus",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
HWND_DESKTOP,
NULL,
hThisInst,
NULL
);
ShowWindow(hwnd, nWinMode);
UpdateWindow(hwnd);
//create the message loop
while(GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
//This function is called by Windows 98 and is passed messages from the message queue.
LRESULT CALLBACK WindowFunc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int response;
switch(message){
case WM_COMMAND:
switch(LOWORD(wParam)){
case IDM_ALPHA:
MessageBox(hwnd, "努力,", "Alpha", MB_OK);
break;
case IDM_BETA:
MessageBox(hwnd, "Nothing is impossible!", "Beta", MB_OK);
break;
case IDM_EXIT:
response=MessageBox(hwnd, "确定退出?", "Exit", MB_YESNO);
if(response==IDYES) PostQuitMessage(0);
break;
case IDM_GAMMA:
MessageBox(hwnd, "加油", "Gamma", MB_OK);
break;
case IDM_EPSILON:
MessageBox(hwnd, "~!~", "Epsilon", MB_OK);
break;
case IDM_ZETA:
MessageBox(hwnd, "一天下来收获还可以吧?", "Zeta", MB_OK);
break;
case IDM_ETA:
MessageBox(hwnd, "呵呵", "Eta", MB_OK);
break;
case IDM_THETA:
MessageBox(hwnd, "没事", "Theta", MB_OK);
break;
case IDM_HELP:
MessageBox(hwnd, "最大的帮助是自救。谢谢您使用本软件。", "Help", MB_OK);
break;
}
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, message, wParam, lParam);
}
return 0;
}
/*=================================================*/
Menu.rc的内容
#include "menu.h"
MyMenu MENU
{
POPUP "&One"
{
MENUITEM "&Alpha", IDM_ALPHA
MENUITEM "&Beta", IDM_BETA
MENUITEM "E&xit", IDM_EXIT
}
POPUP "&Two"
{
MENUITEM "&Gamma", IDM_GAMMA
POPUP "&Delta"
{
MENUITEM "&Epsilon", IDM_EPSILON
MENUITEM "&Zeta", IDM_ZETA
}
MENUITEM "&Eta", IDM_ETA
MENUITEM "&Theta", IDM_THETA
}
MENUITEM "&Help", IDM_HELP
}
[[it] 本帖最后由 Billow0808 于 2008-8-25 19:24 编辑 [/it]]