您的位置:首页 > 其它

解决eVC环境下error RC2104: undefined keyword or key name: I_IMAGENONE的错误

2009-11-28 17:20 549 查看

Question

   I have created a simple 'Hello, world' application for smart phone. It compiles and runs just fine.But when I try to open rc-file in resource editor I get the following error:error RC2104: undefined keyword or key name: I_IMAGENONE
   How can I fix this?

Answer

   This is a known bug confirmed by Microsoft. An .rc file with menubar resources cannot be currently loaded as resource file in eVC. This will be fixed in future versions of Smartphone SDK.  Meanwhile Microsoft recommends to manually edit rc-file in text editor ( see Readme.htm file for Smartphone SDK). It's not a satisfying approach, however, since editing application resources manually is a much more difficult and time-consuming operation than editing them in eVC resurce editor.

  A better approach is to place manubar resource in a separate text file,which will be included in the main rc-file during resource compilation (but not when rc-file is opened in eVC resource editor).

Step by step example.

   1.  Create a new ' Hello World ' application using ' WCE Smartphone 2002 Application ' wizard.
   2.  Add a new text file to your project (File->New, Files tab, 'Text File' item). Call it something like ' hello.rc2 '.
   3.  Try to open its rc-file in the resource editor. You will get RC2104 error.Press ' Edit code ' button to open the rc-file in the text editor.
   4.  Cut menubar resource from rc-file and paste it to rc2-file. After that rc-file will look like this:

//Microsoft Developer Studio generated resource script.
//
#include "resource.h"

////////////////////////////////////////////////////////////////////////////
//
// Menu
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_HELLO_OK "OK"
END


.codearea{ color:black; background-color:white; line-height:18px; border:1px solid #4f81bd; margin:0; width:auto !important; width:100%; overflow:auto; text-align:left; font-size:12px; font-family: "Courier New","Consolas","Fixedsys","BitStream Vera Sans Mono", courier,monospace,serif}
.codearea pre{ color:black; line-height:18px; padding:0 0 0 12px !important; margin:0em; background-color:#fff !important}
.linewrap pre{white-space:pre-wrap; white-space:-moz-pre-wrap; white-space:-pre-wrap; white-space:-o-pre-wrap; word-wrap:break-word; word-break:normal}
.codearea pre.alt{ background-color:#f7f7ff !important}
.codearea .lnum{color:#4f81bd;line-height:18px}

'hello.rc2' file will look like this:

IDR_HELLO_MENUBAR RCDATA
BEGIN
0,
1,
I_IMAGENONE, IDOK, TBSTATE_ENABLED, TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE,
IDS_HELLO_OK, 0, NOMENU,
END


.codearea{ color:black; background-color:white; line-height:18px; border:1px solid #4f81bd; margin:0; width:auto !important; width:100%; overflow:auto; text-align:left; font-size:12px; font-family: "Courier New","Consolas","Fixedsys","BitStream Vera Sans Mono", courier,monospace,serif}
.codearea pre{ color:black; line-height:18px; padding:0 0 0 12px !important; margin:0em; background-color:#fff !important}
.linewrap pre{white-space:pre-wrap; white-space:-moz-pre-wrap; white-space:-pre-wrap; white-space:-o-pre-wrap; word-wrap:break-word; word-break:normal}
.codearea pre.alt{ background-color:#f7f7ff !important}
.codearea .lnum{color:#4f81bd;line-height:18px}

Save both files.

    5.  Open View->Resource Includes dialog.  Add #include "hello.rc2" directive to compile-time directive list.  This way you tell eVC to include ' hello.rc2 ' file in the main rc-file during resources compilation (but not when its edited in resource editor).

    6.  Open rc-file in the resource editor again. You will succeed now. Note that the menubar resource will not be visible.You will have to modify it manually in hello.rc2 file (if necessary). Other resources will be available for editing.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐