Thread: Getting rid of the standard red close(x) button in a Windows application

  1. #1
    Registered User Paderi's Avatar
    Join Date
    Apr 2020
    Posts
    68

    Getting rid of the standard red close(x) button in a Windows application

    In the output screen, top right hand corner of a windows application, there is the red standard close(x) button. In my application I need to get rid of it. How can that be done? Hopefully someone can tell me how to do that.

  2. #2
    Registered User
    Join Date
    Dec 2017
    Posts
    1,664
    You could try this:
    Code:
    EnableMenuItem(GetSystemMenu(hwnd, FALSE), SC_CLOSE, MF_BYCOMMAND | MF_DISABLED);
    All truths are half-truths. - A.N. Whitehead

  3. #3
    Registered User Paderi's Avatar
    Join Date
    Apr 2020
    Posts
    68
    Re your code to get rid of the close(x) button: the compiler doesn't like it. No reason given. (My CodeBlocs doesn't give reasons.) Bur thank you anyway.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,675
    > the compiler doesn't like it. No reason given. (My CodeBlocs doesn't give reasons.)
    This is BS
    The build log and/or build messages tabs at the bottom are sure to show something.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Registered User Paderi's Avatar
    Join Date
    Apr 2020
    Posts
    68
    Nope

  6. #6
    Registered User Paderi's Avatar
    Join Date
    Apr 2020
    Posts
    68
    Quote Originally Posted by Salem View Post
    > the compiler doesn't like it. No reason given. (My CodeBlocs doesn't give reasons.)
    This is BS
    The build log and/or build messages tabs at the bottom are sure to show something.
    I compiled the code in another compiler.
    Error message as follows:

    37 32 E:\SEARCH\Search.cpp [Error] 'hwnd' was not declared in this scope

  7. #7
    Registered User
    Join Date
    Dec 2017
    Posts
    1,664
    You don't know what a window handle (hwnd) is?
    Looks like you need to learn the basics of programming Windows.
    All truths are half-truths. - A.N. Whitehead

  8. #8
    Registered User Paderi's Avatar
    Join Date
    Apr 2020
    Posts
    68
    Quote Originally Posted by john.c View Post
    You don't know what a window handle (hwnd) is?
    Looks like you need to learn the basics of programming Windows.
    It looks like you are a little arrogant man because you know something and want to wank your ego with it.

  9. #9
    Registered User
    Join Date
    Dec 2017
    Posts
    1,664
    It looks like you are a pathetic little loser who wants someone else to write the program for them. Get lost.
    All truths are half-truths. - A.N. Whitehead

  10. #10
    Registered User Paderi's Avatar
    Join Date
    Apr 2020
    Posts
    68
    A forum is there to help others who are less proficient / who know less. Responding to a perfectly decent request for help, by telling the other person he is a looser, because he doesn't know something, shows what you are using this forum for. Namely to create opportunities to wank your ego.

  11. #11
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,675
    Then start by posting actionable information, not random one liner "it doesn't work", and lots of whining about how people are not helping you.

    To date, you've posted ZERO code and ONE error message.

    Instead of bleating "My CodeBlocs doesn't give reasons", you should have done your own STFW for "code blocks doesn't show error messages".

    Getting rid of the standard red close(x) button in a Windows application-code-blocks-show-copy-logs-jpg
    1. If you don't see the log panel at the bottom, press F2
    2. If you don't see the build/error logs, then right-click and choose toggle...
    3. Choose the views you want to see
    4. When you've got the logs, then copy them to the clipboard for pasting to your helpers.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  12. #12
    Registered User
    Join Date
    Feb 2022
    Location
    Canada, PEI
    Posts
    103
    Quote Originally Posted by Paderi View Post
    It looks like you are a little arrogant man because you know something and want to wank your ego with it.
    I always found the pursuit of knowledge to be a pride swallowing experience, especially when you seek knowledge on public forums. I always have to remind myself that I'm seeking the expertise of someone else.. i.e. I'm expecting someone(usually someone with more knowledge) to use their time and energies to help me.

  13. #13
    Registered User Paderi's Avatar
    Join Date
    Apr 2020
    Posts
    68
    G4143 I agree absolutely and unreservedly with you.

  14. #14
    Registered User
    Join Date
    Feb 2019
    Posts
    1,077
    Quote Originally Posted by G4143 View Post
    I always found the pursuit of knowledge to be a pride swallowing experience, especially when you seek knowledge on public forums. I always have to remind myself that I'm seeking the expertise of someone else.. i.e. I'm expecting someone(usually someone with more knowledge) to use their time and energies to help me.
    And not getting paid for it? Very convenient, isn't it?

  15. #15
    Registered User
    Join Date
    Feb 2022
    Location
    Canada, PEI
    Posts
    103
    Quote Originally Posted by flp1969 View Post
    And not getting paid for it? Very convenient, isn't it?
    And that too. We can't forget that some people volunteer their time and expertise for free when they are usually compensated handsomely for that time and expertise.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 11
    Last Post: 06-23-2015, 02:50 AM
  2. Disabling close button
    By dissidia in forum C Programming
    Replies: 9
    Last Post: 12-09-2009, 11:25 AM
  3. how to disable the application close button?
    By e66n06 in forum Windows Programming
    Replies: 8
    Last Post: 01-05-2008, 11:33 AM
  4. Can't turn off a console close button
    By Xzyx987X in forum Windows Programming
    Replies: 9
    Last Post: 03-26-2004, 02:23 AM
  5. Minimize, Maximize and Close button
    By Alextrons in forum Windows Programming
    Replies: 2
    Last Post: 01-10-2002, 10:04 PM

Tags for this Thread