Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8282703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T10:27:55+00:00 2026-06-08T10:27:55+00:00

Can anybody tell me what is wrong with my window creation? This function is

  • 0

Can anybody tell me what is wrong with my window creation? This function is being called from within the main function, and it all compiles and runs fine. However, the window which is rendered is not a window at all, but just a big white square.
Here is my window creation function:

/**
 *  handles everything for initialising a window
 *
 *  @param  hInst               unique handle of window instance
 *  @param  hPrevInst           legacy parameter for copying memory from other instance into this one
 *  @param  cmdLine             commands application is started with
 *  @param  cmdShow             specifies how program should be displayed (maximised, minimized, or hidden)
 */
int Window::Init (HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmdLine, int cmdShow)
{
    //  name of application
    static TCHAR    appName[]       = TEXT ("App");

    //  contains window class information
    WNDCLASSEX      wndC;

    //  window handle
    HWND            hWnd;

    //  define the windows class information
    wndC.cbSize                 = sizeof (WNDCLASSEX);          //  specifies the size of the structure (in bytes)
    wndC.style                  = CS_HREDRAW | CS_VREDRAW;      //  employs window class style to redraw if any resizing occurs
    wndC.lpfnWndProc            = WndProc;                      //  pointer to the window procedure function
    wndC.cbClsExtra             = 0;                            //  number of extra bytres to allocate for window class
    wndC.cbWndExtra             = 0;                            //  number of extra bytes to allocate per window instance
    wndC.hInstance              = hInst;                        //  handle to instnace conatining window procedure for this class
    wndC.hIcon                  = NULL;                         //  handle to large 32x32 (shown when alt + tab)
    wndC.hCursor                = LoadCursor (NULL, IDC_ARROW); //  handle to class cursor resource
    wndC.hbrBackground          = (HBRUSH) (COLOR_WINDOW + 1);  //  handle to class background brush (for painting background)
    wndC.lpszMenuName           = NULL;                         //  pointer to string with name of class menu (no default menu)
    wndC.lpszClassName          = appName;                      //  specifies windows class name
    wndC.hIconSm                = NULL;                         //  handle to small 16x16 icon (top left corner of window)

    //  registers window class with system, will terminate is parameter is invalid
    if (!RegisterClassEx (&wndC))   return 0;

    //  rect used for defining window
    RECT            wndRc;

    //  calculate size of window based on entire client window size
    wndRc.left                  = 0;
    wndRc.top                   = 0;
    wndRc.right                 = 800;
    wndRc.bottom                = 600;

    long            tStyle      = 0;

    //  style chosen based on whether this window is fullscreen
    if (mFullScreen)
        tStyle                  = WS_POPUP;
    else
    {
        tStyle                  = WS_OVERLAPPEDWINDOW;
        //  calculates required size of window rectangle, based on desired client-rectangle size
        AdjustWindowRect (&wndRc, tStyle, FALSE); 
    }

    //  now class is registered, we create a window with it
    hWnd                        = CreateWindowEx (0, appName, appName, WS_POPUP, CW_USEDEFAULT, CW_USEDEFAULT, 
                                    wndRc.right - wndRc.left, wndRc.bottom - wndRc.top, NULL, NULL, hInst, NULL);
    //  check we have a valid handle
    if (hWnd == NULL)               return 0;

    //  show window and update it (cmdShow allows user to specify whether they want window to start maximised, minimised, etc.)
    ShowWindow (hWnd, cmdShow);
    UpdateWindow (hWnd);

    //  if we fail to create the direct x device send an error message and terminate
    if (DirectDraw::GetInstance()->CreateDevice (hWnd, 800, 600, mFullScreen) != 1)
    {
        MessageBox (hWnd, "Failed to create surfaces", "Error", MB_OK);
        return 0;
    }

    //  adds rectangle to the specified window's update region (portion of window to be redrawn)
    InvalidateRect (hWnd, NULL, TRUE);

    return 1;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T10:27:57+00:00Added an answer on June 8, 2026 at 10:27 am

    Courtesy of Arx and Tenfour in the comments to my post, the problem was simply that I was setting the style of my window class to ‘WS_POPUP’ which is obviously not suitable outside of a full screen window.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

can anybody tell me what is wrong with this code, i am getting the
Can anybody tell me why my Async task fails sometimes like this? I tested
Can anybody tell me which View Switcher Control is this in below image.?
can anybody tell me what's the point if any for a javascript function like
can anybody tell me why this works <g:each var=n in=${com.pp.News.list()}> <h2>${n.t}</h2> <p>${n.tx}</p> </g:each> but
can anybody tell me what is wrong with my code. I am tring to
can anybody tell me, what's wrong with my code if AnythingSlider (or rather Firebug)
Can anybody tell me why is this not working. I have created a WCF
i have this rule in .htaccess file which is internal redirect can anybody tell
Can anybody tell me where I am going wrong here? File promoCountFile = new

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.