Go Back   Flash Flash Revolution > Life and Arts > Art and Graphics
Register FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
Old 12-21-2006, 07:51 PM   #1
RandomPscho
FFR Player
 
Join Date: Jun 2006
Location: New York
Age: 34
Posts: 504
Default Chinese characters? What?

EDIT: Sorry this is in the wrong forum, could a moderator move it please?


Hello all

I am trying to learn c++ for win32 apps in Visual Studio 2005.

I followed a tutorial here: http://www.winprog.org/tutorial/simple_window.html
but the code doesn't work in 2005. I got it to work by adding (LPCWSTR) before all the errors saying it couldn't convert. Now it runs, but it has Chinese text in the title, when it is supposed to say Random1Pscho :s

Here is the code, just compile it in Visual Studio 2005 and run. I have no idea why it has chinese characters, can anybody here help?

Code:
#include <windows.h>

const char g_szClassName[] = "myWindowClass";
const char name[] = "Random1Pscho";


LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    switch(msg)
    {
        case WM_CLOSE:
            DestroyWindow(hwnd);
        break;
        case WM_DESTROY:
            PostQuitMessage(0);
        break;
        default:
            return DefWindowProc(hwnd, msg, wParam, lParam);
    }
    return 0;
}

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    LPSTR lpCmdLine, int nCmdShow)
{
    WNDCLASSEX wc;
    HWND hwnd;
    MSG Msg;
  
    wc.cbSize        = sizeof(WNDCLASSEX);
    wc.style         = 0;
    wc.lpfnWndProc   = WndProc;
    wc.cbClsExtra    = 0;
    wc.cbWndExtra    = 0;
    wc.hInstance     = hInstance;
    wc.hIcon         = LoadIcon(NULL, IDI_APPLICATION);
    wc.hCursor       = LoadCursor(NULL, IDC_CROSS);
    wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+4);
    wc.lpszMenuName  = NULL;
    wc.lpszClassName = (LPCWSTR)g_szClassName;
    wc.hIconSm       = LoadIcon(NULL, IDI_APPLICATION);

    if(!RegisterClassEx(&wc))
    {
        MessageBox(NULL, (LPCWSTR)"Window Registration Failed!", (LPCWSTR)"Error!",
            MB_ICONEXCLAMATION | MB_OK);
        return 0;
    }
  
    hwnd = CreateWindowEx(
        WS_EX_CLIENTEDGE,
        (LPCWSTR)g_szClassName,
        (LPCWSTR)name,
        WS_OVERLAPPEDWINDOW,
        CW_USEDEFAULT, CW_USEDEFAULT, 350, 150,
        NULL, NULL, hInstance, NULL);

    if(hwnd == NULL)
    {
        MessageBox(NULL,(LPCWSTR)"Window Creation Failed!",(LPCWSTR)"Error!",
            MB_ICONEXCLAMATION | MB_OK);
        return 0;
    }

    ShowWindow(hwnd, nCmdShow);
    UpdateWindow(hwnd);
   
    while(GetMessage(&Msg, NULL, 0, 0) > 0)
    {
        TranslateMessage(&Msg);
        DispatchMessage(&Msg);
    }
    return Msg.wParam;
}
THANKS A LOT!

Last edited by RandomPscho; 12-22-2006 at 05:17 AM..
RandomPscho is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 12:41 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Copyright FlashFlashRevolution