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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:57:01+00:00 2026-06-13T19:57:01+00:00

i am using C++ win32 API… i have a Windows messagebox contain OKCANCEL Button…

  • 0

i am using C++ win32 API…

i have a Windows messagebox contain OKCANCEL Button…

the messagebox have a close(X-Button) on the right top…

retun1=MessageBox(hDlg,TEXT("Your password will expired,you must change the password"),TEXT("Logon Message"),MB_OK | MB_ICONINFORMATION);

i only want to close the messagebox using the CANCEL Button…

So,i want to disable the X-Button Icon…

i am already try MB_ICONMASK MB_MODEMASK Somethink like that.

But i cant get it,what i need…

How can i Resolve it?

  • 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-13T19:57:03+00:00Added an answer on June 13, 2026 at 7:57 pm

    There’s most likely a bigger problem beyond what you’ve given us, but one way to disable the close button is to set the class style to include CS_NOCLOSE, which you can do with a window handle and SetClassLongPtr. Consider the following full example:

    #include <windows.h>
    
    DWORD WINAPI CreateMessageBox(void *) { //threaded so we can still work with it
        MessageBox(nullptr, "Message", "Title", MB_OKCANCEL);
        return 0;
    }
    
    int main() {
        HANDLE thread = CreateThread(nullptr, 0, CreateMessageBox, nullptr, 0, nullptr);
    
        HWND msg;
        while (!(msg = FindWindow(nullptr, "Title"))); //The Ex version works well for you
    
        LONG_PTR style = GetWindowLongPtr(msg, GWL_STYLE); //get current style
        SetWindowLongPtr(msg, GWL_STYLE, style & ~WS_SYSMENU); //remove system menu 
    
        WaitForSingleObject(thread, INFINITE); //view the effects until you close it
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want to show the messsagebox using win32 API... int pwdexpirydays=5; MessageBox(hdlg,(LPCSTR)(Your password will
i am using Win32 API. i have a thread in c and want to
I have successfully implemented this method of using the Win32 API to set the
I have written a Word add-in in C++ using plain Win32 API. It opens
i am using C++ win32 API... i have these values. pwdlastset date(ex:25-9-2012), current date(ex:1-11-2012),
i have created a dialogbox using c++ win32 API... there are 3 text box,1
I have to implement a read/write lock in C++ using the Win32 api as
I've written a Windows application using the native win32 API. My app will launch
I have a C++ Win32 application written using Win32 API and I wish to
I have created a minidump using win32 api [DllImport(DbgHelp.dll, SetLastError = true)] private static

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.