?
Solved

Control IDs ?

Posted on 1998-12-29
3
Medium Priority
?
180 Views
Last Modified: 2010-04-02
I am creating a listview with the following statement

m_pListView->Create( WS_VISIBLE |  LVS_SINGLESEL | LVS_NOSORTHEADER | LVS_SHOWSELALWAYS | LVS_REPORT, rect, this, ID_LISTVIEW );

This code comes from an example in a book. The problem is that no explanation is given as to where to declare ID_LISTVIEW and what number to make it. If I just use 120 it works but I would like to be a bit more certain about what is going on. All help will be greatly appreciated.
0
Comment
Question by:agrillage
  • 2
3 Comments
 

Accepted Solution

by:
koskia earned 60 total points
ID: 1181218
hello agrillage,
every control in MFC must have a uniqe UINT (32 bit value)
number, which Identifies it.
many calls uses this ID as a parameter,
you can't use 120!
there may be a resource or another control with the same ID
if you want to create a unique id, use a #define statement
there is a constant named 'WM_USER' which is set to a number not use by the system.
you can define your controls from this const and on:
#define ID_MYLISTVIEW1   WM_USER + 1
#define ID_MYLISTVIEW2   WM_USER + 2

and so on.




























0
 
LVL 1

Expert Comment

by:The_Brain
ID: 1181219
what's with all the '\n'?
0
 

Expert Comment

by:koskia
ID: 1181220
just a fluke
my Enter key was pressed down, and probably when you reach a certain size it sends the answer automatically
:))
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Article by: evilrix
Looking for a way to avoid searching through large data sets for data that doesn't exist? A Bloom Filter might be what you need. This data structure is a probabilistic filter that allows you to avoid unnecessary searches when you know the data defin…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question