Solved

Control IDs ?

Posted on 1998-12-29
3
176 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 

Accepted Solution

by:
koskia earned 20 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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

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…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
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 learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

738 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