<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Button Texte nur auf Japanisch???]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich versuche ein Programm zu schreiben das mir einige Controls anzeigt. Funktioniert auch soweit, nur das die Control-Text auf Japanisch oder Chinesisch ausgegeben werden. Kann mir jemand sagen was ich falsch mache?<br />
Hier mal der Code:</p>
<pre><code>// controls.cpp

// INCLUDES ////////////////////////////////////////////////////////////////////////////////////////////
#define WIN32_LEAN_AND_MEAN   // kein MFC

#include &lt;windows.h&gt;
#include &lt;windowsx.h&gt;
#include &lt;iostream&gt;
#include &lt;math.h&gt;
#include &lt;mmsystem.h&gt;
#include &lt;tchar.h&gt;

// DEFINES ////////////////////////////////////////////////////////////////////////////////////////////
#define WINDOW_CLASS_NAME       TEXT(&quot;WINCLASS1&quot;)

#define WINDOW_WIDTH						400 
#define WINDOW_HEIGHT						400

// MACROS /////////////////////////////////////////////////////////////////////////////////////////////
#define KEYDOWN(vk_code)		((GetAsyncKeyState(vk_code) &amp; 0x8000) ? 1 : 0)
#define KEYUP	 (vk_code)    ((GetAsyncKeyState(vk_code) &amp; 0x8000) ? 0 : 1)

// GLOBALS ////////////////////////////////////////////////////////////////////////////////////////////
HWND				main_window_handle = NULL;
HINSTANCE		hInstApp					 = NULL;
char				buffer[80];

// FUNCTIONS //////////////////////////////////////////////////////////////////////////////////////////
LRESULT CALLBACK WinProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
  // In dieser Funktion werden alle Ereignisse für 
  // dieses Fenster(siehe hWnd) abgearbeitet

  PAINTSTRUCT ps;     // wird bei WM_PAINT benötigt(WM = Window Message)
  HDC         hdc;    // ein handle zu einem device
	char buffer[80];

  // der ankommende Event wird verzweigt
  switch(msg)
  {
  case WM_CREATE:
    {
      // hier wird alles initialisiert

      return(0);
    }break;

	case WM_COMMAND:
		{
			// get the device
			hdc = GetDC(hWnd);

			// set background mode
			SetBkMode(hdc, OPAQUE);

			// select a random text and background color
			SetTextColor(hdc, RGB(0,255,0));
			SetBkColor(hdc, RGB(128,128,128));

			// print out the wparam and lparam
			sprintf(buffer, &quot;LOWORD(wParam) = %d, HIWORD(wParam) = %d                    &quot;,
							LOWORD(wParam), HIWORD(wParam));

			// print text at a random location
			TextOut(hdc, 220, 100, (LPCWSTR)buffer, strlen(buffer));

			sprintf(buffer, &quot;LOWORD(lParam) = 0X%X, HIWORD(lParam) = 0X%X                    &quot;,
							LOWORD(lParam), HIWORD(lParam));

			// print text at a random location
			TextOut(hdc, 220, 140, (LPCWSTR)buffer, strlen(buffer));

			// release the device
			ReleaseDC(hWnd, hdc);

		}break;

  case WM_PAINT:
    {
      // ohne diese 2 Methoden läuft gar nichts
      hdc = BeginPaint(hWnd, &amp;ps);
      // hierhin gehört alles was gezeichnet werden soll 
      EndPaint(hWnd, &amp;ps);

      return(0);
    }break;

  case WM_DESTROY:
    {
      // diese Methode killt die Anwendung
      PostQuitMessage(0);

      return(0);
    }break;

  default:break;

  }/* end switch */ 

  // alle Events abfangen die nicht behandelt wurden
  return (DefWindowProc(hWnd, msg, wParam, lParam));

}/* end WinProc */

// WINMAIN ///////////////////////////////////////////////////////////////////////////////////////
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow)
{
  WNDCLASSEX wce;       // speichert die Klasse die wir erstellen
  HWND       hWnd;      // generischer window handle
  MSG        msg;       // generische message
	HDC				 hdc;
	HPEN			 pen = NULL;

  // Window Klasse wird erstellt
  wce.cbSize        = sizeof(WNDCLASSEX);
  wce.style         = CS_DBLCLKS | CS_OWNDC | CS_HREDRAW | CS_VREDRAW;
  wce.lpfnWndProc   = WinProc;
  wce.cbClsExtra    = 0;
  wce.cbWndExtra    = 0;
  wce.hInstance     = hInst;
  wce.hIcon         = NULL;
  wce.hCursor       = NULL;
  wce.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH);
  wce.lpszMenuName  = NULL;
  wce.lpszClassName = WINDOW_CLASS_NAME;
  wce.hIconSm       = NULL;

  // speichert hInst in globaler Variablen
  hInstApp = hInst;

  // Window Klasse regestrieren
  if(!RegisterClassEx(&amp;wce))
    return(0);

  // Fenster erstellen
  if(!(hWnd = CreateWindowEx(NULL, WINDOW_CLASS_NAME, TEXT(&quot;Controls&quot;), WS_OVERLAPPEDWINDOW | WS_VISIBLE, 
                             0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, NULL, NULL, hInst, NULL)))
       return(0);

	main_window_handle = hWnd;

	// create the buttons
#define BUTTON_BASE_ID			100
#define NUM_BUTTONS					8

	char *button_names[NUM_BUTTONS] =
	{
		&quot;PUSHBUTTON&quot;,
		&quot;RADIOBUTTON&quot;,
		&quot;CHECKBOX&quot;,
		&quot;3STATE&quot;,
		&quot;AUTO3STATE&quot;,
		&quot;AUTOCHECKBOX&quot;,
		&quot;AUTORADIOBUTTON&quot;,
		&quot;OWNERDRAW&quot;
	};

	DWORD button_types[NUM_BUTTONS] =
	{
		BS_PUSHBUTTON,
		BS_RADIOBUTTON,
		BS_CHECKBOX,
		BS_3STATE,
		BS_AUTO3STATE,
		BS_AUTOCHECKBOX,
		BS_AUTORADIOBUTTON,
		BS_OWNERDRAW
	};

	for(int button = 0; button &lt; NUM_BUTTONS; button++)
	{

		//char *test = button_names[button];
		CreateWindowEx(NULL,																// extended style
									 TEXT(&quot;button&quot;),											// class name
									 (LPCWSTR)button_names[button],												// title
									 WS_CHILD | WS_VISIBLE | button_types[button],
									 10,10+button*36,											// initial x, y
									 strlen(button_names[button])*16,24,	// initial width, height
									 main_window_handle,									// handle to parent
									 (HMENU)(BUTTON_BASE_ID + button),		// handle to menu
									 hInst,																// instance of this app
									 NULL);																// extra creation params
	}/* end for button */

	while(TRUE)
	{
		if(PeekMessage(&amp;msg, NULL, 0, 0, PM_REMOVE))
		{
			// test if this a quit
			if(msg.message == WM_QUIT)
				break;

			// translate any accelerator keys
			TranslateMessage(&amp;msg);

			// send message to win proc
			DispatchMessage(&amp;msg);
		}/* end if */

		// main game processing goes here
		if (KEYDOWN(VK_ESCAPE))
			SendMessage(hWnd, WM_CLOSE, 0,0);

	}/* end while */

  // zurück zu Windows
  return(msg.wParam);

}/* end WinMain */
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/219995/button-texte-nur-auf-japanisch</link><generator>RSS for Node</generator><lastBuildDate>Wed, 07 Oct 2026 15:07:05 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/219995.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 10 Aug 2008 16:13:19 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Button Texte nur auf Japanisch??? on Sun, 10 Aug 2008 16:13:19 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich versuche ein Programm zu schreiben das mir einige Controls anzeigt. Funktioniert auch soweit, nur das die Control-Text auf Japanisch oder Chinesisch ausgegeben werden. Kann mir jemand sagen was ich falsch mache?<br />
Hier mal der Code:</p>
<pre><code>// controls.cpp

// INCLUDES ////////////////////////////////////////////////////////////////////////////////////////////
#define WIN32_LEAN_AND_MEAN   // kein MFC

#include &lt;windows.h&gt;
#include &lt;windowsx.h&gt;
#include &lt;iostream&gt;
#include &lt;math.h&gt;
#include &lt;mmsystem.h&gt;
#include &lt;tchar.h&gt;

// DEFINES ////////////////////////////////////////////////////////////////////////////////////////////
#define WINDOW_CLASS_NAME       TEXT(&quot;WINCLASS1&quot;)

#define WINDOW_WIDTH						400 
#define WINDOW_HEIGHT						400

// MACROS /////////////////////////////////////////////////////////////////////////////////////////////
#define KEYDOWN(vk_code)		((GetAsyncKeyState(vk_code) &amp; 0x8000) ? 1 : 0)
#define KEYUP	 (vk_code)    ((GetAsyncKeyState(vk_code) &amp; 0x8000) ? 0 : 1)

// GLOBALS ////////////////////////////////////////////////////////////////////////////////////////////
HWND				main_window_handle = NULL;
HINSTANCE		hInstApp					 = NULL;
char				buffer[80];

// FUNCTIONS //////////////////////////////////////////////////////////////////////////////////////////
LRESULT CALLBACK WinProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
  // In dieser Funktion werden alle Ereignisse für 
  // dieses Fenster(siehe hWnd) abgearbeitet

  PAINTSTRUCT ps;     // wird bei WM_PAINT benötigt(WM = Window Message)
  HDC         hdc;    // ein handle zu einem device
	char buffer[80];

  // der ankommende Event wird verzweigt
  switch(msg)
  {
  case WM_CREATE:
    {
      // hier wird alles initialisiert

      return(0);
    }break;

	case WM_COMMAND:
		{
			// get the device
			hdc = GetDC(hWnd);

			// set background mode
			SetBkMode(hdc, OPAQUE);

			// select a random text and background color
			SetTextColor(hdc, RGB(0,255,0));
			SetBkColor(hdc, RGB(128,128,128));

			// print out the wparam and lparam
			sprintf(buffer, &quot;LOWORD(wParam) = %d, HIWORD(wParam) = %d                    &quot;,
							LOWORD(wParam), HIWORD(wParam));

			// print text at a random location
			TextOut(hdc, 220, 100, (LPCWSTR)buffer, strlen(buffer));

			sprintf(buffer, &quot;LOWORD(lParam) = 0X%X, HIWORD(lParam) = 0X%X                    &quot;,
							LOWORD(lParam), HIWORD(lParam));

			// print text at a random location
			TextOut(hdc, 220, 140, (LPCWSTR)buffer, strlen(buffer));

			// release the device
			ReleaseDC(hWnd, hdc);

		}break;

  case WM_PAINT:
    {
      // ohne diese 2 Methoden läuft gar nichts
      hdc = BeginPaint(hWnd, &amp;ps);
      // hierhin gehört alles was gezeichnet werden soll 
      EndPaint(hWnd, &amp;ps);

      return(0);
    }break;

  case WM_DESTROY:
    {
      // diese Methode killt die Anwendung
      PostQuitMessage(0);

      return(0);
    }break;

  default:break;

  }/* end switch */ 

  // alle Events abfangen die nicht behandelt wurden
  return (DefWindowProc(hWnd, msg, wParam, lParam));

}/* end WinProc */

// WINMAIN ///////////////////////////////////////////////////////////////////////////////////////
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow)
{
  WNDCLASSEX wce;       // speichert die Klasse die wir erstellen
  HWND       hWnd;      // generischer window handle
  MSG        msg;       // generische message
	HDC				 hdc;
	HPEN			 pen = NULL;

  // Window Klasse wird erstellt
  wce.cbSize        = sizeof(WNDCLASSEX);
  wce.style         = CS_DBLCLKS | CS_OWNDC | CS_HREDRAW | CS_VREDRAW;
  wce.lpfnWndProc   = WinProc;
  wce.cbClsExtra    = 0;
  wce.cbWndExtra    = 0;
  wce.hInstance     = hInst;
  wce.hIcon         = NULL;
  wce.hCursor       = NULL;
  wce.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH);
  wce.lpszMenuName  = NULL;
  wce.lpszClassName = WINDOW_CLASS_NAME;
  wce.hIconSm       = NULL;

  // speichert hInst in globaler Variablen
  hInstApp = hInst;

  // Window Klasse regestrieren
  if(!RegisterClassEx(&amp;wce))
    return(0);

  // Fenster erstellen
  if(!(hWnd = CreateWindowEx(NULL, WINDOW_CLASS_NAME, TEXT(&quot;Controls&quot;), WS_OVERLAPPEDWINDOW | WS_VISIBLE, 
                             0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, NULL, NULL, hInst, NULL)))
       return(0);

	main_window_handle = hWnd;

	// create the buttons
#define BUTTON_BASE_ID			100
#define NUM_BUTTONS					8

	char *button_names[NUM_BUTTONS] =
	{
		&quot;PUSHBUTTON&quot;,
		&quot;RADIOBUTTON&quot;,
		&quot;CHECKBOX&quot;,
		&quot;3STATE&quot;,
		&quot;AUTO3STATE&quot;,
		&quot;AUTOCHECKBOX&quot;,
		&quot;AUTORADIOBUTTON&quot;,
		&quot;OWNERDRAW&quot;
	};

	DWORD button_types[NUM_BUTTONS] =
	{
		BS_PUSHBUTTON,
		BS_RADIOBUTTON,
		BS_CHECKBOX,
		BS_3STATE,
		BS_AUTO3STATE,
		BS_AUTOCHECKBOX,
		BS_AUTORADIOBUTTON,
		BS_OWNERDRAW
	};

	for(int button = 0; button &lt; NUM_BUTTONS; button++)
	{

		//char *test = button_names[button];
		CreateWindowEx(NULL,																// extended style
									 TEXT(&quot;button&quot;),											// class name
									 (LPCWSTR)button_names[button],												// title
									 WS_CHILD | WS_VISIBLE | button_types[button],
									 10,10+button*36,											// initial x, y
									 strlen(button_names[button])*16,24,	// initial width, height
									 main_window_handle,									// handle to parent
									 (HMENU)(BUTTON_BASE_ID + button),		// handle to menu
									 hInst,																// instance of this app
									 NULL);																// extra creation params
	}/* end for button */

	while(TRUE)
	{
		if(PeekMessage(&amp;msg, NULL, 0, 0, PM_REMOVE))
		{
			// test if this a quit
			if(msg.message == WM_QUIT)
				break;

			// translate any accelerator keys
			TranslateMessage(&amp;msg);

			// send message to win proc
			DispatchMessage(&amp;msg);
		}/* end if */

		// main game processing goes here
		if (KEYDOWN(VK_ESCAPE))
			SendMessage(hWnd, WM_CLOSE, 0,0);

	}/* end while */

  // zurück zu Windows
  return(msg.wParam);

}/* end WinMain */
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1562301</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1562301</guid><dc:creator><![CDATA[daniel4w]]></dc:creator><pubDate>Sun, 10 Aug 2008 16:13:19 GMT</pubDate></item></channel></rss>