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
Printable View
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
Come on guys, I know that is a stupid question, but I need a stupid answer! Hehe, I hate borland.
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.
I dont use Borland (I use MSVC), so I am not used to its clas library (if indeed you are using that!)..Quote:
Originally posted by Roul
Come on guys, I know that is a stupid question, but I need a stupid answer! Hehe, I hate borland.
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...
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....Code:WM_COMMAND
wNotifyCode = HIWORD(wParam); // notification code
wID = LOWORD(wParam); // item, control, or accelerator identifier
hwndCtl = (HWND) lParam; // handle of control
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.:(
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!