#include <windows.h>
#include <string>
using namespace std;
int WINAPI WinMain(HINSTANCE hinstance,
HINSTANCE hprevinstance,
LPSTR lpcmdline,
int ncmdshow)
{string str = "cpp string";
MessageBox(NULL, "ok","ok",NULL);
return(0);
}我看书上代码是怎么写的可是为什么我的VC2K5编译器 提示编译错误??如果这样写:MessageBox(NULL, TEXT("ok"),TEXT("ok"),NULL);就没错了可是书上确实是这么写的:
MessageBox(NULL, "ok","ok",NULL);另外如果用MessageBox输出标准库的string??
#include <string>
using namespace std;
int WINAPI WinMain(HINSTANCE hinstance,
HINSTANCE hprevinstance,
LPSTR lpcmdline,
int ncmdshow)
{string str = "cpp string";
MessageBox(NULL, "ok","ok",NULL);
return(0);
}我看书上代码是怎么写的可是为什么我的VC2K5编译器 提示编译错误??如果这样写:MessageBox(NULL, TEXT("ok"),TEXT("ok"),NULL);就没错了可是书上确实是这么写的:
MessageBox(NULL, "ok","ok",NULL);另外如果用MessageBox输出标准库的string??
STL的string有一个c_str,例如
string str = "hello";
MessageBox(NULL,str.c_str,NULL,NULL);