Solved

Prefix for Windows controls....

Posted on 2000-02-25
4
426 Views
Last Modified: 2013-11-20
I was reading through some of the Hungarian Notation, and I began to wonder about the prefixes in the variable names. If I create an edit control and use DDX to access it, what prefix should I use? Are there any standard prefixes to all Windows controls? Is it, m_edit...., m_combo and so on? All suggections are appreciated....
0
Comment
Question by:joakimf
[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
4 Comments
 
LVL 1

Expert Comment

by:Deckmeister
ID: 2557460
Hi,

I use the same name than the control's ID. For instance, you create a editbox, a listbox and a tree control.
Then, you would have :
IDC_EDIT_DOGNAME   -> m_EditDogName
IDC_LIST_DOGS      -> m_ListDogs (usually I write m_ListOfDogs)
IDC_TREE_BREEDINGS -> m_TreeBreedings (or m_TreeOfBreedings)

And so on.
I think it works fine, because you always know the data type you work with.

But I don't know official standard prefixes to control variables.
0
 
LVL 12

Expert Comment

by:migel
ID: 2557961
Hi!
I usually use prefix m_wnd....CtrlType
where ... - is control name -
and CtrlType - is its type
for example for Edit control for input Num1:
m_wndNum1Edit
0
 
LVL 11

Accepted Solution

by:
mikeblas earned 50 total points
ID: 2558989
> Are there any standard prefixes to all Windows controls?

No, there isn't. The Hungarian Whitepaper predates MFC by about three years.

Some people do this:

   m_wndFirstName
   m_wndLastName
   m_wndExempt

and that lets you know they're windows, but doesn't tell you the type.  Some people do

   m_editFirstName
   m_editLastName
   m_checkExempt  

and that's better (in my opinion).

It's really a preference thing, and you need to decide for yourself (and maybe your team or organization) what works best for you. Besides: nobody _really_ follows Hungarian fully, anyway.

..B ekiM
0
 
LVL 1

Author Comment

by:joakimf
ID: 2562273
Thanks for your comments
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

710 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