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 8891337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:42:59+00:00 2026-06-14T22:42:59+00:00

I have created a program that – among other things – changes the console

  • 0

I have created a program that – among other things – changes the console window size and removes the window borders from it (mostly by setting the window style to WS_POPUP).
Now on my computer, the application is executed with no problems whatsoever, but when I run the code in another computer (or in VirtualBox), I get some funky glitches.

Here’s an image that shows these glitches I speak of:
glitches with awesome depth of field

These glitches appearead if the user moved/opened a window on top of the console window and then brought the console window to the top again.
So naturally, I thought that the easiest way to get rid of this problem would be to make the console window always on top, but that didn’t help, because now the glitches just take their ‘background’ from whatever was there before the new window was moved/opened on top (or rather, below) the console window.
It seems that the glitched areas are somehow cached/stored somewhere, and do not notice that the window has been resized.

GetClientRect(hWnd, &rClnt);
rClnt.top += 1;
rClnt.bottom -= 2;
rClnt.right -= 1;
SetWindowRgn(hWnd, CreateRectRgnIndirect(&rClnt), 1);
SetWindowLongPtr(hWnd, GWL_STYLE, WS_POPUP);
exStyle = GetWindowLongPtr(hWnd, GWL_EXSTYLE);
exStyle &= ~WS_EX_CLIENTEDGE;
SetWindowLongPtr(hWnd, GWL_EXSTYLE, exStyle);
BringWindowToTop(hWnd);
SetWindowPos(hWnd, HWND_TOPMOST, ((rScr.right / 2) - rWnd.right / 2) - 1, (rScr.bottom / 2) - rWnd.bottom / 2, 0, 0, SWP_FRAMECHANGED | SWP_DRAWFRAME | SWP_NOSIZE);// After this I just use ShowWindow().
  • 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-14T22:43:01+00:00Added an answer on June 14, 2026 at 10:43 pm

    I managed to fix the glitches.

    All I did was I moved the SetWindowRgn() function just above the ShowWindow() (which would be at the very end of the code snippet).
    This removed the glitched areas, and now my window displays correctly.

    There was a bug where the window was not centered afterwards, but I fixed it by changing

    if(!SetWindowPos(hWnd, HWND_TOPMOST, ((rScr.right / 2) - rWnd.right / 2) - 1, (rScr.bottom / 2) - rWnd.bottom / 2, 0, 0, SWP_FRAMECHANGED | SWP_DRAWFRAME | SWP_NOSIZE))
    

    to

    if(!SetWindowPos(hWnd, HWND_TOPMOST, ((rScr.right / 2) - rClnt.right / 2) - 1, (rScr.bottom / 2) - rClnt.bottom / 2, 0, 0, SWP_FRAMECHANGED | SWP_DRAWFRAME | SWP_NOSIZE))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a program that decrypts whats stored in a export file from
I have created a non-form c# program that uses the NotifyIcon class. The text
I have a program that is used to create other program and compile it
I have created a program that write video stream to a named pipe on
I have created a program that opens image files. How can I make my
I have created a little program that reads in a Java file and feeds
I have created a GUI program that uses a class to perform some tasks.
I have created a very simple program that uses recursion. I'm using the g++
I have successfully created a Java program that runs fine on my development computer,
I have created the output for a program that allows a user to input

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.