【问题标题】:How To Call A String Resource In C++如何在 C++ 中调用字符串资源
【发布时间】:2011-06-08 08:46:16
【问题描述】:

在资源.h

#define String1 333

在资源.rc中

#include <windows.h>
#include "resource.h"

STRINGTABLE
{
    STRING1                   "hie people"
}

在 main.cpp 中

#include<iostream.h>
#include<resource.h>
#include<windows.h>
using namespace std;
int main{
cout<<here i want to output string value from resource how to call the string;
}

还有一个我在代码块中编译的问题。它说 resource.h 不在我错的地方

【问题讨论】:

  • @Blagovest Buyukliev 谢谢
  • 请用 VC++ 或您正在使用的任何工具标记它 - 它与 C(根据现有标记)或 C++(根据标题)本身无关。
  • 好的,我下次会注意的。实际上我不知道,因为我是新手
  • 这不是问题 - 只是帮助具有相关知识的人关注您,而其他人将您过滤掉;-)。干杯。

标签: string visual-c++ resources


【解决方案1】:

我假设它是 Visual C++ 并且您正在使用 MFC。就像调用一样简单:

::LoadString(...)

如果你使用的是 MFC,那么

CString str;
str.LoadString(STRING1)

LoadString from MSDN

An Example here of how to use LoadString

【讨论】:

  • @Dapu,然后使用第一个版本。你必须提供论据。我也添加了链接
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-06-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多