NO

Author Topic: enable / disable buttons - tutorials / examples  (Read 3940 times)

champ

  • Guest
enable / disable buttons - tutorials / examples
« on: May 13, 2007, 11:46:29 PM »
Hello out there,

here comes again a question from a very beginner:

I am currently trying to make my first application. And really it allready has some functions ;-)

I have designed the principle layout which is (as far as I understand) stored in the .rc-file.
I have defined the buttons "start" and "stop". Of course "stop" should only be possible if "start" has been pushed before and vice versa.

How can I handle this in the code?

-------

I fear I could ask hundreds of questions, because it's the first time I am trying to write an application for windows. The next problem I will have is to make some text and graphics outputs in the window. Are there somewhere (simple) examples for such problems or tutorials that explain how to handle these things with Pelles C?

Best regards

Martin

JohnF

  • Guest
Re: enable / disable buttons - tutorials / examples
« Reply #1 on: May 14, 2007, 07:47:28 AM »
You can enable and disable buttons by using the API EnableWindow.

When your app starts use EnableWindow to disable the stop button, when the start button has been clicked use EnableWindow to disable the start and enable the stop.

EnableWindow(GetDlgItem(hDlg, ID_BUTTON), FALSE); // disable
EnableWindow(GetDlgItem(hDlg, ID_BUTTON), TRUE); // enable
 
John