Solved

Control IDs ?

Posted on 1998-12-29
3
177 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
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 pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

705 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