Quick question..

This is a discussion on Quick question.. within the C++ Programming forums, part of the General Programming Boards category; I have been working with Borland 6. I created a button labeled "Ok". When clicked, I want it to close ...

  1. #1
    Roul
    Guest

    Quick question..

    I have been working with Borland 6. I created a button labeled "Ok". When clicked, I want it to close the prog. How do I do this. Something I have to type in the Action box? Is there a place where I can find a list of actions?
    Thx

  2. #2
    Roul
    Guest
    Come on guys, I know that is a stupid question, but I need a stupid answer! Hehe, I hate borland.

  3. #3
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Put a DestroyWindow(hWnd); under WM_COMMAND. If you have several buttons, you have to specify their ID:s.

    And this thread belongs in the windows programming section.
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  4. #4
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    Originally posted by Roul
    Come on guys, I know that is a stupid question, but I need a stupid answer! Hehe, I hate borland.
    I dont use Borland (I use MSVC), so I am not used to its clas library (if indeed you are using that!)..

    Basically......You have a dialogbox or a window for which you added a button......On clicking that button, the window/dialogbox will recieve a WM_COMMAND message from the system...

    Code:
    WM_COMMAND 
    wNotifyCode = HIWORD(wParam); // notification code 
    wID = LOWORD(wParam);         // item, control, or accelerator identifier 
    hwndCtl = (HWND) lParam;      // handle of control
    So in you code you need to handle that message. Whenever you recieve one, and you identify that it came from your button, you close the program with something like PostQuitMessage() or whatever is suitable....

    The way you identify that button is either by;

    LOWORD(wParam) - this will be the number that identifys the button as specified in your resource editor

    or

    (HWND) lParam - This will be the windows handle of the button.

    Sorry if this is a little vague, but you havent really provided the specifice of how you created your button......so I have to be vague.

  5. #5
    Roul
    Guest
    Thanks for the help guys, I will test it out. Sorry for putting it in the wrong section!! I never realized. If I forgot to mention, I am try to do it with C++ Builder 6. Thanx again!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Very quick math question
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 10-27-2005, 12:05 AM
  2. very quick question.
    By Unregistered in forum C++ Programming
    Replies: 7
    Last Post: 07-24-2002, 04:48 AM
  3. quick question
    By Unregistered in forum C++ Programming
    Replies: 5
    Last Post: 07-22-2002, 05:44 AM
  4. Quick Question Regarding Pointers
    By charash in forum C++ Programming
    Replies: 4
    Last Post: 05-04-2002, 12:04 PM
  5. Quick question: exit();
    By Cheeze-It in forum C Programming
    Replies: 6
    Last Post: 08-15-2001, 06:46 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21