When I build and run code, the window opens and closes instantly

Anonymous
2023-08-19T10:39:57.4666667+00:00

The program '[8796] PLEASE.exe' has exited with code 184 (0xb8).

How to get the window to stay open? Even a hello world program window doesnt stay open.

gg.JPG

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
12,075 questions
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,449 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,916 questions
{count} votes

1 answer

Sort by: Most helpful
  1. RLWA32 48,391 Reputation points
    2023-08-19T11:18:35.78+00:00

    The program you are running is incomplete. It is missing a message loop so it exits immediately. Because it does not return an int value upon exit the error code that is printed is not meaningful. These are not the only issues with the code that is shown by the attached image.

    You should create a new project using the Windows Desktop Application template as shown below -

    desktop

    This will create a fully formed Windows desktop application that you can study and/or modify to meet your needs.

    And you may also benefit by referring to Intro to Win32 programming in C++

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.