Button Texte nur auf Japanisch???



  • Hallo,

    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?
    Hier mal der Code:

    // controls.cpp
    
    // INCLUDES ////////////////////////////////////////////////////////////////////////////////////////////
    #define WIN32_LEAN_AND_MEAN   // kein MFC
    
    #include <windows.h>
    #include <windowsx.h>
    #include <iostream>
    #include <math.h>
    #include <mmsystem.h>
    #include <tchar.h>
    
    // DEFINES ////////////////////////////////////////////////////////////////////////////////////////////
    #define WINDOW_CLASS_NAME       TEXT("WINCLASS1")
    
    #define WINDOW_WIDTH						400 
    #define WINDOW_HEIGHT						400
    
    // MACROS /////////////////////////////////////////////////////////////////////////////////////////////
    #define KEYDOWN(vk_code)		((GetAsyncKeyState(vk_code) & 0x8000) ? 1 : 0)
    #define KEYUP	 (vk_code)    ((GetAsyncKeyState(vk_code) & 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, "LOWORD(wParam) = %d, HIWORD(wParam) = %d                    ",
    							LOWORD(wParam), HIWORD(wParam));
    
    			// print text at a random location
    			TextOut(hdc, 220, 100, (LPCWSTR)buffer, strlen(buffer));
    
    			sprintf(buffer, "LOWORD(lParam) = 0X%X, HIWORD(lParam) = 0X%X                    ",
    							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, &ps);
          // hierhin gehört alles was gezeichnet werden soll 
          EndPaint(hWnd, &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(&wce))
        return(0);
    
      // Fenster erstellen
      if(!(hWnd = CreateWindowEx(NULL, WINDOW_CLASS_NAME, TEXT("Controls"), 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] =
    	{
    		"PUSHBUTTON",
    		"RADIOBUTTON",
    		"CHECKBOX",
    		"3STATE",
    		"AUTO3STATE",
    		"AUTOCHECKBOX",
    		"AUTORADIOBUTTON",
    		"OWNERDRAW"
    	};
    
    	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 < NUM_BUTTONS; button++)
    	{
    
    		//char *test = button_names[button];
    		CreateWindowEx(NULL,																// extended style
    									 TEXT("button"),											// 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(&msg, NULL, 0, 0, PM_REMOVE))
    		{
    			// test if this a quit
    			if(msg.message == WM_QUIT)
    				break;
    
    			// translate any accelerator keys
    			TranslateMessage(&msg);
    
    			// send message to win proc
    			DispatchMessage(&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 */
    

Anmelden zum Antworten