Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: createwindow title messed up

  1. #1
    Junior Member Newbie
    Join Date
    May 2016

    createwindow title messed up

    This is how I created my window. I'm creating it in ASCII, the title showed is random characters.
    I'm using cygwin in windows. this code works totally fine with virtual studio 2010. with CreatWindow without A. However, I cannot compile CreateWindow here.

    What I have tried:
    change 1 to static wchar_t szTitle[] = L"Getting..."
    change 1 to static wchar_t szTitle[] = _T(str)
    change 2 to L"Getting..."
    change 2 to _T(str)

    static char szAppName[] = "OpenGL";
    1. static char szTitle[]="Getting Started With OpenGL";

    hWnd = CreateWindowA(
    szAppName, // app name
    2. szTitle, // Text for window title bar
    WS_OVERLAPPEDWINDOW// Window style
    // NEED THESE for OpenGL calls to work!
    left, top, width, height,
    NULL, // no parent window
    NULL, // Use the window class menu.
    m_hInstance,// This instance owns this window
    NULL // We don't use any extra data

  2. #2
    Senior Member OpenGL Lord
    Join Date
    May 2009
    Besides the fact that you used the string "OpenGL", what does this question have to do with OpenGL? This is clearly a Win32 issue, and it probably has to do with some ANSI locale setting or somesuch.

  3. #3
    Member Regular Contributor Agent D's Avatar
    Join Date
    Sep 2011
    Innsbruck, Austria
    Ther are two versions of CreateWindow (and similar functions): CreateWindowW that supports wide characters and CreateWindowA that doesn't.

    If you have "UNICODE" defined via the preprocessor inclusion of the winapi header containing the declaration, CreateWindow is defined to
    CreateWindowW. If you don't have UNICODE defined, it points to CreateWindowA.

    VisualStudio has the macro UNICODE defined by default in the project settings.

    Edit: Also, as Alfonse Reinheart pointed out, this not an OpenGL related problem in any way whatsoever.

  4. #4
    Junior Member Newbie
    Join Date
    May 2016
    oh, thank you. I thought of that. But I just want to make sure there is no problem with the code.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts