|
Yes when the _DEBUG is not defined as in release build the code is not included.
Happy programming!!
|
|
|
|
|
ASSERT is defined differently in debug and releasemode.
In debug (When _DEBUG is defined):
#define ASSERT(f) \
do \
{ \
if (!(f) && AfxAssertFailedLine(THIS_FILE, __LINE__)) \
AfxDebugBreak(); \
} while (0) \ In release (When _DEBUG isn't defined):
#define ASSERT(f) ((void)0)
I.e. In releasemode, the compiler actually ignores the expression, since ASSERT(whatever) is replaced with ((void)0).
Sprudling
|
|
|
|
|
Thanx. Tis the answer i was looking for
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
My CD is damaged for Tom Armstrong's book - "Designing and Using ActiveX Controls".
The sampe code for chapters 8-11 is unreadable. I have had the book for too long to return it. His web site only contains corrections to source not the full source.
Does anybody have this CD? Would you email me the chapters?
lynnphilmcgahan@msn.com
P.S. This book is worth owning.
|
|
|
|
|
There should be a contact email ID on his web site. Try mailing there and request that you'd like to download the entire source or even ask for a CD, they might give you one free.
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
Thanks. I tried this a week or so ago, but got no response from the webmaster or customer service.
Good idea, thanks anyway.
|
|
|
|
|
My question is 2 parts.
1) I am creating a CDateTimeCtrl to show/get the 24-hour time of day. However, my control hides the hour field behind the left margin of the control. So I see "mm:ss PM" instead of "HH:mm:ss" (for example.)
How can I get my control to show entire time string? "HH:mm:ss"
2) I want to display "HH:mm:ss", but I only know of DTS_TIMEFORMAT.
How can I get my control to display "HH:mm:ss" (24-hour format).
Details:
1) The CDateTimeCtrl's dimensions are large enough to display everything, but somehow, the text is shifted left in my control. I can use the L-R arrows to reveal what is hidden.
2) I am creating a DWORD dwStyle set of attributes, but I don't know how to create a custom time format.
DWORD dwStyle = WS_CHILD | WS_VISIBLE |DTS_UPDOWN | WS_TABSTOP | DTS_TIMEFORMAT;
Your help would be greatly appreciated.
Thanks,
Johnny
|
|
|
|
|
Hi there,
I was wondering what is the most delicate way of including a function that will be available to all files in a visual c mfc project?
You can off course create a header and cpp containing the function and then put the header in stdafx.h and use that all over the place.
You can dynamically cast to the parent windows in a child window and access a function defined there.
You can use include files all over the place refering to the file containing the function.
But is there any nicer way of doing this? since this is just one function call, is there a better way of doing it?
|
|
|
|
|
the easiest way is the first one you list (stdafx). i usually do the third way (include where you need it).
there's not much else you can do, given the way C/C++ works - you have to #include a header somewhere (or define the function separately in each file)
-c
Smaller Animals Software, Inc.
You're the icing - on the cake - on the table - at my wake. Modest Mouse
|
|
|
|
|
You can convert all the global functions to members of your cwinapp derived class. Then you can always use :-
((Cyourapp*)AfxGetApp())->yourfunction()
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
The best way to do this, because global functions are evil, is to define it in your stdafx.h and stdafx.cpp, but wrap it in a namespace. Then it's not global but you can MyNamespace::Myfunction from anywhere in the project.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Picture the daffodil. And while you do that, I'll be over here going through your stuff.
|
|
|
|
|
Cool!
Thanks for the info CG.
I thought you can only have classes and structs in namespaces
I didnt think you could have a function in a namespace
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
Nish [BusterBoy] wrote:
Thanks for the info CG.
No worries - it was a bit of a revelation to me when I realised, because there are times you need something visible from anywhere, and I *hate* global functions or variables, because it's only a matter of time before they collide with something.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Picture the daffodil. And while you do that, I'll be over here going through your stuff.
|
|
|
|
|
I have already asked this question earlier today, but i might not have explained it well;
Can any one tell me how do you make a resizable array.
Our Instructor wants us to start an array of size 1. and just grows as you keep adding stuff to it.(it does not have to shrink).
He also said that we cannot use any libraries so we have to create our own data type i guess.
no includes no call to lib functions!!!
Thanks
|
|
|
|
|
Take a look at
this place .
I'm sure you will find at least one solution for your problem.
Also, you can find CSimpleArray in ATLBASE.H That would solve your problem.
I vote pro drink
|
|
|
|
|
I think he wants you guys to create your own array structure. You can create a struct with a member variable which is an int array. Each time they add a new element you can delete the current array and new a new array. For efficiency you can do it in jumps of a jump factor [say 256]. Have another member variable which has the count of array items.
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
""For efficiency you can do it in jumps of a jump factor [say 256]. Have another member variable which has the count of array items.""
what do you mean i can do it in jumps?
|
|
|
|
|
Each time they add a new element to the array, if you are going to delete the current internal array and create a new one, your array would not be a very efficient tool. So assign memory in blocks of 256 or 512. Thus when they keep adding elements, we only change our element count. But the moment they cross 256, we delete our internal int* and new a new int* with an extra 256 [or whatever the jump factor]
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
sorry for asking to many questions(i hate it myself);
but what do you mean by "So assign memory in blocks of 256 or 512"
how do you do this without creating an array of a certain size other than one.
thanks!
|
|
|
|
|
new_array = new char[new_count * block_size];
if(sizeof (new_array) > sizeof (old_array) )
memcpy(new_array,old_array,sizeof old_array);
else
memcpy(new_array,old_array,sizeof new_array);
delete old_array;
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
Everything that Nish has explained to you, I explained earlier. You should stop assuming you asked the question badly, and start assuming you need to do some study to get to a point of being able to understand the answer.
Nish is saying ( as I said ) that it's more efficient to allocate more memory than you need, and keep track of what you've used, then reallocate another block as needed, than to expand the reserved memory every time you add to it.
The post that pointed out an ATL header which contains a simple array class is all the answer you need - look at the class he is recommending and you'll see an example implimntation of what you need. Naturally you should use this to learn, not just copy it.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Picture the daffodil. And while you do that, I'll be over here going through your stuff.
|
|
|
|
|
well thanks to both of you.
and sorry for misundestanding what you wrote Christian.
I really did not want the code I just want the idea how it should work;
but anyways thanks you two again, if you guys are there answering every question i post, I wonder how you all make your livings. i mean it's just insane coz you guys are here 16 hours a day. I could tell from how often you post stuff.
|
|
|
|
|
Marwan wrote:
wonder how you all make your livings. i mean it's just insane coz you guys are here 16 hours a day.
We are all employed by Chris Maunder of Code Project.
I make 480K annually
CG makes a little bit less on account of his lack of C# skills. That's why he is learning C# now
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
Nish [BusterBoy] wrote:
I make 480K annually
Based on your previous comments of how much people in India get an hour, this means you work 1315 hours a day, every day.
Nish [BusterBoy] wrote:
CG makes a little bit less on account of his lack of C# skills. That's why he is learning C# now
Oh, you're taking about clam shells ? Yeah, I make a bit less than 480,000 clam shells a year. I'm gonna catch up though, once I get into this C# stuff.....
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Picture the daffodil. And while you do that, I'll be over here going through your stuff.
|
|
|
|
|
Christian Graus wrote:
Based on your previous comments of how much people in India get an hour, this means you work 1315 hours a day, every day.
Cruel, cruel man!
Christian Graus wrote:
Oh, you're taking about clam shells ? Yeah, I make a bit less than 480,000 clam shells a year. I'm gonna catch up though, once I get into this C# stuff.....
LOL
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|