message box and unicode problem

This is a discussion on message box and unicode problem within the Windows Programming forums, part of the Platform Specific Boards category; i use a vs7 ide i want to display a message box with russian text i enabled unicode in my ...

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    36

    message box and unicode problem

    i use a vs7 ide
    i want to display a message box with russian text
    i enabled unicode in my program and i wrote in ide editor the text i want to display in russian
    but when the message box pops up i see some wierd stuff...

    can anyone help me with this?

  2. #2
    Even death may die... Dante Shamest's Avatar
    Join Date
    Apr 2003
    Location
    Malaysia
    Posts
    970
    i enabled unicode in my program
    How?

  3. #3
    Registered User
    Join Date
    Mar 2004
    Posts
    36
    like this:

    _UNICODE and UNICODE are commented out because these are enabled by default in project properties(if i enable them i get a redefinition warning)

    there is a setting in project properties under:
    configuration properties -> general -> character set

    i changed character set property to use unicode... but i checked that if i put it on use multibyte... or Not setthen everything works ok...

    so what this setting means?

    Code:
    #define WIN32_LEAN_AND_MEAN    
    
    //#define _UNICODE
    #include <tchar.h>
    
    //#define UNICODE         
    #include <windows.h>           
    
    #include "resource.h"
    
    
    LRESULT CALLBACK WndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam);
    
    int WINAPI _tWinMain(HINSTANCE hInst,HINSTANCE hPreInst,LPTSTR lpszCmdLine,int nCmdShow)
    {
    	_TCHAR g_szClassName[] = _T("myWindowClass");
    	WNDCLASSEX wc;
        HWND hwnd;
        MSG Msg;
    	
        wc.cbSize        = sizeof(WNDCLASSEX);
        wc.style         = 0;
        wc.lpfnWndProc   = WndProc;
        wc.cbClsExtra    = 0;
        wc.cbWndExtra    = 0;
        wc.hInstance     = hInst;
        wc.hIcon         = LoadIcon(NULL, IDI_APPLICATION);
        wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
        wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
        wc.lpszMenuName  = NULL;
        wc.lpszClassName = g_szClassName;
        wc.hIconSm       = LoadIcon(NULL, IDI_APPLICATION);
    
    // this is THE messagebox
        MessageBox(NULL, _T("жми ок"), _T("привет"),
                MB_ICONEXCLAMATION | MB_OK);
       if(!RegisterClassEx(&wc))
        {
            MessageBox(NULL, _T("Window Registration Failed!"), _T("Error!"),
                MB_ICONEXCLAMATION | MB_OK);
            return 0;
        }
    
        hwnd = CreateWindowEx(
            WS_EX_CLIENTEDGE,
            g_szClassName,
            _T("The title of my window"),
            WS_OVERLAPPEDWINDOW,
            CW_USEDEFAULT, CW_USEDEFAULT, 240, 120,
            NULL, NULL, hInst, NULL);
    
        if(hwnd == NULL)
        {
            MessageBox(NULL, _T("Window Creation Failed!"), _T("Error!"),
                MB_ICONEXCLAMATION | MB_OK);
            return 0;
        }
    
        ShowWindow(hwnd, nCmdShow);
        UpdateWindow(hwnd);
    
    	while (GetMessage(&Msg,NULL,0,0))
        {
    		TranslateMessage(&Msg);
            DispatchMessage(&Msg);
    	}
    	return 0;
    }
    Last edited by Jumper; 05-11-2004 at 04:07 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Where is my UNICODE extended wide character ?
    By intmail in forum Linux Programming
    Replies: 3
    Last Post: 02-15-2006, 10:20 AM
  2. How to type Unicode Box Drawing?
    By Jumper in forum Windows Programming
    Replies: 0
    Last Post: 07-14-2004, 01:18 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21