Thread: Quick question..

  1. #1

    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?

  2. #2
    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
    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.

    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
    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...

    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


    (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 I have to be vague.

  5. #5
    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
    Replies: 8
    Last Post: 10-26-2005, 11:05 PM
  2. very quick question.
    By Unregistered in forum C++ Programming
    Replies: 7
    Last Post: 07-24-2002, 03:48 AM
  3. quick question
    By Unregistered in forum C++ Programming
    Replies: 5
    Last Post: 07-22-2002, 04:44 AM
  4. Quick Question Regarding Pointers
    By charash in forum C++ Programming
    Replies: 4
    Last Post: 05-04-2002, 11:04 AM
  5. Quick question: exit();
    By Cheeze-It in forum C Programming
    Replies: 6
    Last Post: 08-15-2001, 05:46 PM