|
I would like to accomplish the following:
If i pass my mouse over an edit box control on my application, i would like windows to display some text. Just like if you pass your mouse over a windows button, it describes the functionality etc.
Does anyone know how to do this?
|
|
|
|
|
|
Hmmmm!
How does the CToolTipClass work?
|
|
|
|
|
I would like to accomplish the following.
1. I would like some text in a record list to change color when i need to.
The text is "YES". I am inserting "YES" in the TEXT column using
SetItemText(i, TEXT, "YES") ;
Sometimes though, i would like to control the color. Like make it red
that that record has more importance. How would i accomplish this in MFC?
-- modified at 10:54 Friday 26th August, 2005
|
|
|
|
|
|
i'd like to get all ur advice for naming a Variable,Funtion, etc..etc..
for example,
how do you name a function like GET MACHINE STATE()
Is it nice to say like GetMachineState? or getMachineState() or getmachinestate() or GETMACHINESTATE()
AND FOR VARIABLES..
int eventCount; or EventCount; or eventcout;?
long C_value; or c_Value; or C_Value; ?
which one do u prefer? i've been messing up my program by not following a particular convention..
thanks ,
V
|
|
|
|
|
make ur convention and follow it up
|
|
|
|
|
whatz your way of naming them?
Thanks
V
|
|
|
|
|
Typically you would pick a convention that is comfortable and obvious to you, and use it consistently.
Vivekuniq wrote:
Is it nice to say like GetMachineState? or getMachineState() or getmachinestate() or GETMACHINESTATE()
In this case, I'd opt for the first one.
Vivekuniq wrote:
AND FOR VARIABLES..
int eventCount; or EventCount; or eventcout;?
I would use nEventCount .
Vivekuniq wrote:
long C_value; or c_Value; or C_Value; ?
I would use lValue although it does not describe what kind of value.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
My last C++ project used the following,
class CTestClass
{
private:
int m_classMember;
public:
int GetMachineState(int currentState)
{
int newState = currentState;
if(currentState != m_classMember)
newState = 12;
return newState;
}
};
Previous projects have used Hungarian Notation but with all my C# work, I've sort of gone off it.
Michael
CP Blog [^] Development Blog [^]
|
|
|
|
|
Michael P Butler wrote:
Previous projects have used Hungarian Notation but with all my C# work, I've sort of gone off it.
Your current style looks sort of Java-ish. Is this something that C# has advocated?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
sunit i quite right !
however, i could had this :
the most used is certainly the hungarian notation.
here is the main points to know about it.
a letter can prefix the name of a variable to show its type :
i or n integer
f float
d double
l long
c character
b boolean
dw double word
w word
by or byte byte
sz C-style null-terminated string
str C++ string object
h handle
v vector
pt point
rgb RGB triplet
p pointer to
r reference to
u unsigned
a or ary array of
m_ member variable
g_ global variable
s_ static variable
the name of an identifier must be the most explicit as possible.
you can find different styles, such as getMachineState(), GetMachineState(), get_machine_state(), etc...
upper case identifiers are in general for constants...
to this, there are also some specific rules, but the most important is that you should select your own, and follow them !
TOXCCT >>> GEII power [toxcct][VisualCalc]
-- modified at 11:11 Friday 26th August, 2005
|
|
|
|
|
We use CamelCase for function and variable naming although variables always start in lower case while functions start in uppercase:
m_myVariable
MyFunction();
When you know the rule, you can tell at a glance whether its a function or a variable.
If you vote me down, my score will only get lower
|
|
|
|
|
got nice tips from u all..i think i need to change my style a lot.. thank u guys
thanx
V
|
|
|
|
|
How can I know that which Lan users are accessing the folders which I have shared?
|
|
|
|
|
Use NetShareEnum().
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
I was freaked out with this code until went to disassembly
Find what you need to fix problem?
#include "stdafx.h"
class CA
{
public:
// do not add default constructor here
// solve problem with out it
CA(int nA)
{
m_nA = nA;
}
int m_nA;
};
class CB : virtual public CA
{
public:
CB(int nB) : CA(nB)
{
m_nB = nB;
}
int m_nB;
};
class CC : virtual public CA
{
public:
CC(int nC) : CA(nC)
{
m_nC = nC;
}
int m_nC;
};
class CD : public CC, public CB
{
public:
CD(int nD) : CC(nD), CB(nD)
{
m_nD = nD;
}
int m_nD;
};
int _tmain(int argc, _TCHAR* argv[])
{
CD oD(1);
//error C2512: 'CA::CA' : no appropriate default constructor available
return 0;
}
//funny ha?
-- modified at 10:21 Friday 26th August, 2005
|
|
|
|
|
Aha! This is obviously the classic "Diamond-of-Death" inheritance problem in the code. If you have this in your code, then you seriously need to rethink!
Joel Holdsworth
-- modified at 10:43 Friday 26th August, 2005
|
|
|
|
|
u should provide default contructor if you define argument contructor
|
|
|
|
|
Replace constructor declaration
CD(int nD) : CA(nD), CC(nD), CB(nD)
Just so simple
|
|
|
|
|
yes it will show error.u have to mention default construtor
CD(int nD) : CC(nD), CB(nD)
if u instantiated object of Class CD
say CD cd(4);
then both CC and CB( CC(int nC) : CA(nC) and CB(int nB):CA(nC)) will try to assign the data member of CA.whereas it is Virtually inherited in both Classes(CC,CB).So only one copy of Class CA has to be present.
-- modified at 11:10 Friday 26th August, 2005
|
|
|
|
|
Replace constructor declaration
CD(int nD) : CA(nD), CC(nD), CB(nD)
Just so simple
|
|
|
|
|
Replace constructor declaration
CD(int nD) : CA(nD), CC(nD), CB(nD)
Just so simple
|
|
|
|
|
from where does "new" operator allocate memory?
I don't know anything about memory management. I was only interested in "new" operator. but now I have encountered a lot memory allocation functions and I don't know their differences.
HeapAlloc, GlobalAlloc, AllocateUserPhysicalPages, ...
can you give a reference for me to understand them?
also, please say what is page?
|
|
|
|
|
Ali Tavakol wrote:
from where does "new" operator allocate memory?
the default 'new' calls nh_malloc / malloc, internally, which allocates memory from the heap.
Cleek | Image Toolkits | Thumbnail maker
-- modified at 9:58 Friday 26th August, 2005
|
|
|
|