| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 789 人关注过本帖
标题:[帮忙]用C学windows98编程时下面程序遇见fatal error RC1004
只看楼主 加入收藏
Billow0808
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2008-8-25
收藏
 问题点数:0 回复次数:1 
[帮忙]用C学windows98编程时下面程序遇见fatal error RC1004
用C学windows98编程时下面程序遇见fatal error RC1004: unexpected end of file found
Error 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
}
搜索更多相关主题的帖子: Windows编程 
2008-08-26 17:56
Billow0808
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2008-8-25
收藏
得分:0 
解决了,在此谢谢"兔(31490047)"帮我发现.
问题在程序里的菜单名与资源中的菜单名相差了个空格.把程序中
wcl.lpszMenuName="My Menu";  //main menu
改为
wcl.lpszMenuName="MyMenu";  //main menu
即可.
2008-08-27 17:05
快速回复:[帮忙]用C学windows98编程时下面程序遇见fatal error RC1004
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.033214 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved