Solved

Control IDs ?

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
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 viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
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.

707 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now