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
    Mar 2015
    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
    Senior 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.

Similar Threads

  1. When to call CreateWindow in multithreaded app?
    By Inquisitor in forum OpenGL: Windows
    Replies: 2
    Last Post: 04-27-2008, 10:06 AM
  2. pbuffer without CreateWindow?
    By vmh5 in forum OpenGL: Windows
    Replies: 2
    Last Post: 08-14-2006, 09:25 AM
  3. glut32.lib CreateWindow
    By in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 03-17-2005, 07:06 AM
  4. How to Get A Title Bar in Gerbera?
    By evening in forum OpenGL ES
    Replies: 1
    Last Post: 01-13-2005, 06:59 AM
  5. Linux and createWindow
    By in forum OpenGL: Linux
    Replies: 1
    Last Post: 01-11-2001, 12:18 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean