Discussion:
Dlg template question
(too old to reply)
Vincent Fatica
2009-08-19 00:46:48 UTC
Permalink
With the resource editor I made a dialog template. I put a static text control
and an OK button in it. My project builds, and runs, and the dlg shows, but
there are no identifiers for the two controls in resource.h. I can't do
anything with the controls without IDs. I thought I get them automatically.
Their "properties" show IDs (but resource.h doesn't). What's up? Thanks.
--
- Vince
David Wilkinson
2009-08-19 01:51:37 UTC
Permalink
Post by Vincent Fatica
With the resource editor I made a dialog template. I put a static text control
and an OK button in it. My project builds, and runs, and the dlg shows, but
there are no identifiers for the two controls in resource.h. I can't do
anything with the controls without IDs. I thought I get them automatically.
Their "properties" show IDs (but resource.h doesn't). What's up? Thanks.
The default OK button has ID of IDOK = 1.

Default static text control has ID of IDC_STATIC = -1.

Neither of these will appear in your resource.h. It is usually a good idea to
change the ID of the static control to something unique.
--
David Wilkinson
Visual C++ MVP
Vincent Fatica
2009-08-19 03:24:58 UTC
Permalink
On Tue, 18 Aug 2009 21:51:37 -0400, David Wilkinson <no-***@effisols.com>
wrote:

|Vincent Fatica wrote:
|> With the resource editor I made a dialog template. I put a static text control
|> and an OK button in it. My project builds, and runs, and the dlg shows, but
|> there are no identifiers for the two controls in resource.h. I can't do
|> anything with the controls without IDs. I thought I get them automatically.
|> Their "properties" show IDs (but resource.h doesn't). What's up? Thanks.
|
|The default OK button has ID of IDOK = 1.
|
|Default static text control has ID of IDC_STATIC = -1.
|
|Neither of these will appear in your resource.h. It is usually a good idea to
|change the ID of the static control to something unique.

Not only is it a good idea, it's apparently necessary in order to get IDs in the
header file.
--
- Vince
Scot T Brennecke
2009-08-19 06:51:27 UTC
Permalink
Post by Vincent Fatica
|> With the resource editor I made a dialog template. I put a static text control
|> and an OK button in it. My project builds, and runs, and the dlg shows, but
|> there are no identifiers for the two controls in resource.h. I can't do
|> anything with the controls without IDs. I thought I get them automatically.
|> Their "properties" show IDs (but resource.h doesn't). What's up? Thanks.
|
|The default OK button has ID of IDOK = 1.
|
|Default static text control has ID of IDC_STATIC = -1.
|
|Neither of these will appear in your resource.h. It is usually a good idea to
|change the ID of the static control to something unique.
Not only is it a good idea, it's apparently necessary in order to get IDs in the
header file.
To use the static, you must change the ID, as you know. To use the OK button, you don't need to have an ID in the header file; IDOK
will work.
David Webber
2009-08-19 11:58:01 UTC
Permalink
Post by Vincent Fatica
On Tue, 18 Aug 2009 21:51:37 -0400, David Wilkinson
|Neither of these will appear in your resource.h. It is usually a good idea to
|change the ID of the static control to something unique.
Not only is it a good idea, it's apparently necessary in order to get IDs in the
header file.
The problem word here is "the". IDOK and IDC_STATIC do indeed each appear
in 'a' header file - just not in your own :-)

(They are defined in winuser.h and afxres.h respectively.)

Dave
--
David Webber
Author of 'Mozart the Music Processor'
http://www.mozart.co.uk
For discussion/support see
http://www.mozart.co.uk/mozartists/mailinglist.htm
Loading...