|
Post a specific example of the code and what you want to accomplish.
Kuphryn
|
|
|
|
|
I don' have no code suh'. If I did it would fill the message buffer on CP pretty darn quick. Think big big project.
My question is: What is it in namespaces or use of STL in general that would cause conflict with the use of old fashion <fstream.h>. I tried replacing all the <fstream.h>'s with <fstream> (the STL version) There are some differences in the member functions, I tried to scope the namespace properly and it still didn't work.
J.
----------------------------
|
|
|
|
|
|
Hi,
Can someone explain me or has a class for a small ComboBox ?
I would like to have a ComboBox with a little Edit Box, a small button, a small scroll button,...
Like in these exemples :
http://www.codeproject.com/listctrl/xlistctrl.asp
http://www.codeproject.com/docking/ToolbarWithCombo.asp
I tried to understand these prog, but can't understand !
(Sorry, I'm just a student !)
Thanks a lot.
Cynicannibal
|
|
|
|
|
The height of the button on a combo box (and the minimum height of the box as a whole) is determined by the size of the font used to draw text in the comb. Change the font to a smaller one & you get a smaller combo box.
A servant to formulaic ways.
Shog9
|
|
|
|
|
thanks,
wow, it seems so easy !!!
but I've tried and don't know how to do that.
I've done :
CFont f;
f.CreatePointFont(80,"Arial");
m_cbTest.SetFont(&f);
But it doesn't work.
Can you help me again ?
Phil
|
|
|
|
|
Two things - first, make sure the CFont object is a member variable of your dialog class, not a local variable (else it'll be deleted when it goes out of scope). Second, an 80pt Arial font is probably large enough you won't notice the change... Besides, you probably aren't sizing your controls in points anyway. Try this, adjust as necessary:
m_font.CreateFont(-8,0,0,0,0,0,0,0,0,0,0,0,0,"Arial");
This will create a font with a total height of 8 pixels - the combo box will be slightly larger because of borders and such.
A servant to formulaic ways.
Shog9
|
|
|
|
|
k, it works, thanks.
Cynicannibal
|
|
|
|
|
Hi, I need some help, I'm trying to make a function that fills the length of some string with 0 at left, the function receives two parameters, the string, and the desired length, but when I compile it, appears an error, the error C2440 cannot convert from 'class CString' to 'int'
-------------------------------------
Here is my function:
CSValidating::fill(CString a, int b)<br />
{<br />
CString filled;<br />
filled = a;<br />
while (filled.GetLength() < b)<br />
filled = "0" + filled;<br />
<br />
return filled;<br />
}
--------------------------------------
I would appreciatte if someone can help me to solve this error...
thnxz
|
|
|
|
|
Try declaring retuned value as CString or CString&
|
|
|
|
|
ponshio wrote:
CSValidating::fill(CString a, int b)
should read something like:
CString CSValidating::fill(CString a, int b)
C++ functions return int by default if you don't specify the return type, so the conversion error is referring to the return filled;
I would suggest that you can improve on that algorithm somewhat too - the hint is that CString has a constructor that can take a character ('0' ) and a number (something like b - filled.GetLength() ) indicating how many times to repeat it
--
Ian Darling
"The moral of the story is that with a contrived example, you can prove anything." - Joel Spolsky
|
|
|
|
|
You may have to reverse the order of "0" and filled. I think I recall that there is no overloaded "+" for const char* + CString
And probly better to pass as a reference rather than replicating the CString twice.
J.
----------------------------
|
|
|
|
|
As the others pointed out, you are returning an int - probably without knowing it.;P
You definitely need to return a CString , not CString& or *CString . You cannot return anything local to your function, as it needs to exist after your function has terminated.
Your first parameter should be a const CString& : As you are only ever reading it, so you can promise that to the compiler and let it optimize your code. It should be a reference, as there is no point in making a temporary copy of the CString just for this call (as the normal call-by-value does). Yes, I know about CString doing refernce counting, but this is beginner level.
Third, your variable names could be longer and more 'telling' about their use. But that is purely personal style.
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
Hi,
In my application i have this:
HBITMAP hImage;
hImage = (HBITMAP)::LoadImage (AfxGetInstanceHandle(), "c:\\TEMP.bmp", IMAGE_BITMAP, 0, 0,
LR_LOADFROMFILE |LR_CREATEDIBSECTION );
DeleteObject(hImage);
These statement will increase the memory usage by 28 KB.
Size of the "temp.bmp" file is 360KB.
Could any one tell me why is it so?
Regards
Neha
|
|
|
|
|
Neha wrote:
These statement will increase the memory usage by 28 KB.
How are you measuring this?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Using window task manager mem usage for that application.
|
|
|
|
|
the value displayed in the task manager is not correct at all!
Don't try it, just do it!
|
|
|
|
|
Is there any proof for that?
|
|
|
|
|
The best you could hope to come from TM is to show the size of the address space that is in use, not the amount of that address space that your program is actually using. Perhaps you are confusing address space with program size.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
I am talking about the Mem usage column in the processes tab.
I think this represents the memory usage by the application.
|
|
|
|
|
this is not the answer to your question, but for loading a bitmap from the disk, you dont need to pass the hInst to the function!
Don't try it, just do it!
|
|
|
|
|
Still no difference..
One more strange thing is when some of function been called, It will increase the memory usage by 4KB.Those function don't allocate anything......
|
|
|
|
|
Neha wrote:
One more strange thing is when some of function been called, It will increase the memory usage by 4KB.Those function don't allocate anything......
How do you know? When you call a function that is not your own, are you sure of what it does, or doesn't do, behind the scene?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
If you execute that code 100 times does it increase the memory in task manager by 2800 K?
If yes, then it is a memory leak.
If no, it is just increasing the process address space one time to reflect the additional library code you used.
|
|
|
|
|
Yes,It increases by 2800K........
|
|
|
|