   [C++/Win] Mimic Ex routines?
  Google didn't help here.Can you create a window using CreateWindow() and tailor it to behave in a way that WNDCLASSEX and CreateWindowEx() could have them do?[Edited by - zyrolasting on May 26, 2010 11:17:50 PM]
  Part of creating a window usually involves registering the window class of your own specifications. If you gave us a little more information on what it is you're trying to achieve, it'd help a lot towards us helping you. In any case, here's part of the code I used when creating my own windows:  hInstance = GetModuleHandle(0);    WNDCLASSEX wcex;  std::memset(&wcex,0,sizeof(WNDCLASSEX));  wcex.cbSize = sizeof(WNDCLASSEX);  wcex.lpfnWndProc = (WNDPROC)internalWin32GLWindowProc;  wcex.hInstance = hInstance;  wcex.hCursor = LoadCursor(0,IDC_ARROW);  wcex.lpszClassName = "Win32GLWindow";  wcex.style = CS_OWNDC;    if (!RegisterClassEx(&wcex)){    displayMessage("An Error Occured While Creating The Window Class","ERROR");    return false;  }    windowedStyle = WS_VISIBLE | WS_OVERLAPPEDWINDOW;    if (!resizable){    windowedStyle ^= (WS_MAXIMIZEBOX | WS_SIZEBOX);  }    RECT bounds = {0,0,width,height};  int rectStyle;  int rectStyleEx = WS_EX_APPWINDOW;  if (fullscreen){    rectStyle = WS_POPUP;  }else{    rectStyle = WS_OVERLAPPEDWINDOW;    //additional ex styles are needed, depending on resizability    if (resizable) rectStyleEx |= WS_EX_WINDOWEDGE;    else rectStyleEx |= WS_EX_STATICEDGE;  }  AdjustWindowRectEx(&bounds,rectStyle,false,rectStyleEx);    //set correct sizes  bounds.right -= bounds.left;  bounds.bottom -= bounds.top;  bounds.left = 0;  bounds.top = 0;    //offset the left and top values to center the screen if windowed  if (!fullscreen){    DEVMODE mode;    if (EnumDisplaySettings(0,ENUM_CURRENT_SETTINGS,&mode)){ bounds.left = (mode.dmPelsWidth - bounds.right) / 2; bounds.top = (mode.dmPelsHeight - bounds.bottom) / 2;    }  }    //copy it to the windowed bounds  windowedBounds = bounds;    if (!(hWnd = CreateWindow(    "Win32GLWindow",title,    fullscreen ? WIN32_FULLSCREEN_STYLE : windowedStyle,    bounds.left,bounds.top,bounds.right,bounds.bottom,    0,0,hInstance,0  ))){    UnregisterClass("Win32GLWindow",hInstance);    displayMessage("An Error Occured While Creating The Window","ERROR");    return false;  }As you can see, I don't use CreateWindowEx(), but according to the MSDN description of it, the only difference is in the way it covers other windows.   ;  Take a look at CreateWindow in the windows headers, specifically WinUser.hCreateWindow maps to one of two macros, depending on the project settings, maps to either CreateWindowA or CreateWindowW.CreateWindowA And CreateWindowW are also macros that map to CreateWindowExA(0, ...) and CreateWindowExW(0, ...) respectively.  So there is currently no difference between CreateWindowEx and CreateWindow, except that CreateWindow just sets the extended style automatically to 0.   ;  Actually CreateWindowEx will set the extended style WS_EX_CLIENTEDGE by itself if you pass 0 as extended style.   ;Quote:Original post by RattrapCreateWindowA And CreateWindowW are also macros that map to CreateWindowExA(0, ...) and CreateWindowExW(0, ...) respectively.  So there is currently no difference between CreateWindowEx and CreateWindow, except that CreateWindow just sets the extended style automatically to 0.This at best misleading. CreateWindowA/W are not macros, there are functions defined in user32.dll with these names.   ;  From winuser.h:#define CreateWindowA(lpClassName, lpWindowName, dwstyle, x, y,\ nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)\ CreateWindowExA(0L, lpClassName, lpWindowName, dwstyle, x, y,\ nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)#define CreateWindowW(lpClassName, lpWindowName, dwstyle, x, y,\ nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)\ CreateWindowExW(0L, lpClassName, lpWindowName, dwstyle, x, y,\ nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)#ifdef UNICODE#define CreateWindow  CreateWindowW#else#define CreateWindow  CreateWindowA#endif // !UNICODE;Quote:Original post by DaBookshahThis at best misleading. CreateWindowA/W are not macros, there are functions defined in user32.dll with these names.The functions in user32.dll are likely there to provide backwards compatibility to before they made these changes.  As I and SiCrane states above, currently in the Windows SDK, they are just macros to CreateWindowEx now.   