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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:07:37+00:00 2026-06-17T10:07:37+00:00

It compiles and runs with no error. The only thing is that the window

  • 0

It compiles and runs with no error. The only thing is that the window doesn’t show up. The destructor should stay forever until I close the window by mouse ?

#include <windows.h>
#include <richedit.h>

class richEdit {
  HWND richeditWindow;
  richEdit() {
    HMODULE richedit_library = LoadLibrary("Msftedit.dll");
    if (NULL == richedit_library) abort();

    HINSTANCE hInstance = (HINSTANCE)GetModuleHandle(0);
    richeditWindow = CreateWindowExW (
      WS_EX_TOPMOST,
      MSFTEDIT_CLASS,
      L"window text",
      WS_OVERLAPPED | WS_SYSMENU | ES_MULTILINE | WS_VISIBLE,
      0, 0, 500, 500,
      NULL, NULL, hInstance, NULL
    );
  }
  ~richEdit() {
    MSG msg;
    while( GetMessageW( &msg, richeditWindow, 0, 0 ) ) {
      TranslateMessage( &msg );
      DispatchMessageW( &msg );
    }
  }
};

int main() {
  richEdit re();
}
  • 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-17T10:07:39+00:00Added an answer on June 17, 2026 at 10:07 am

    Your problem is here:

    richEdit re();
    

    Is not a default-constructed object of type richEdit. Is a declaration of a function named re that takes no arguments and returns a richEdit.

    You want this instead:

    richEdit re;
    

    …or in C++11:

    richEdit re{};
    

    Note that a blocking destructor is something that will certainly give you headaches in the future.

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

Sidebar

Related Questions

My cocos2d iOS game code compiles and runs without error in Xcode 4.2.1 but
The compiler doesn't give me any error and the code runs. Just curious how
I have a project that compiles and runs on my system but when I
I have some code that compiles and runs on MSVC++ but will not compile
We have a Jenkins task that runs overnight and compiles a project group containing
I inherited a project that makes extensive use of JMS. It compiles, runs and
This piece of code compiles and runs as expected on GCC 3.x and 4.x:
The following C++ program compiles and runs as expected: #include <stdio.h> int main(int argc,
Please check this code out it compiles and runs absolutely fine.. The question is
I've implemented the Attached Behavior Command pattern which compiles and runs fine , but

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.