開発環境 |
Microsoft Visual C++ 2010 Express (SP1) |
実行環境 |
Microsoft Windows XP Home Edition (SP3) |
プロジェクトの種類 |
Win32 プロジェクト |
プロジェクト名 |
WinTest |
アプリケーションの種類 |
Windows アプリケーション |
追加のオプション |
空のプロジェクト |
Windowsで使われる文字(列)の型
型名 |
定義 |
型名の元となったと思われるもの |
CHAR |
char |
Character |
WCHAR |
wchar_t |
Wide Character |
TCHAR |
CHAR / WCHAR |
Text Character |
LPSTR |
CHAR * |
Long Pointer String |
LPWSTR |
WCHAR * |
Long Pointer Wide character String |
LPTSTR |
LPSTR / LPWSTR |
Long Pointer TCHAR String |
LPCSTR |
const CHAR * |
Long Pointer Constant String |
LPCWSTR |
const WCHAR * |
Long Pointer Constant Wide character String |
LPCTSTR |
LPCSTR / LPCWSTR |
Long Pointer Constant TCHAR String |
マルチ バイト文字セット(Multi Byte Character Set)対応
WinTest_mbcs.c
// マルチ バイト文字セット
#include <Windows.h>
int APIENTRY WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
MessageBox(NULL, lpCmdLine, "Caption", MB_OK);
return 0;
}
Unicode 文字セット(Unicode Character Set)対応
WinTest_ucs.c
// Unicode 文字セット
#include <Windows.h>
int APIENTRY wWinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPWSTR lpCmdLine,
int nCmdShow)
{
MessageBox(NULL, lpCmdLine, L"Caption", MB_OK);
return 0;
}
Unicode 文字セット(Unicode Character Set)対応
WinTest_text.c
// Unicode 文字セット
#include <Windows.h>
int APIENTRY wWinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
MessageBox(NULL, lpCmdLine, TEXT("Caption"), MB_OK);
return 0;
}
両文字セット対応
WinTest_tchar.c
#include <tchar.h>
#include <Windows.h>
int APIENTRY _tWinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
MessageBox(NULL, lpCmdLine, _T("Caption"), MB_OK);
return 0;
}
最終更新:2012年09月10日 22:17