|
A google search on "mfc collection classes" yields links to many articles.
The MFC/ATL documentation for each class is pretty good too, with code samples.
|
|
|
|
|
Raj Gopal wrote: Plz provide me some link related to mfc collection classes especially map classes
Here is one[^].
BTW a simple search with Google with keyword as "MFC Collection classes" should have helped you much better.
|
|
|
|
|
thx for the link sir.
are there any good articles in code project for easy understanding?
|
|
|
|
|
Hi All,
I use a CStatic to show a bitmap in a dialog. The bitmap is a thumbnail of a file. Everytime when a file is chosen, the code call CStattic::SetBitmap to associates a new bitmap with the static control and the bitmap will be shown out immediately. But I minimize the dialog and maximize the dialog again, the bitmap in the CStatic control can't be shown out.
Do you know how to show the picture out again when the dialog is maximized?
thanks,
Eric
|
|
|
|
|
Sounds like you've got a problem with the control not repainting itself. What if you call Invalidate() on the CStatic when your form is shown ? ( NOte : this should have happened by itself )
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Is the bitmap getting deleted after you set it?
If you're using CBitmap, and it goes out of scope, it will delete the gdi object.
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
The code is like this:
{
CBitmap tempBitmap;
...
HBITMAP hBitmap = HBITMAP(tempBitmap);
m_picHolder.SetBitmap(hBitmap);
...
}
When call SetBitmap again, the bitmap can be shown out. But it will disappear after minimize and maximize the dialog.
Thanks,
Eric
|
|
|
|
|
Eric Vonjacson wrote: CBitmap tempBitmap;
You need to create on heap , using new.
Or , make CBitmap object, as member variable along with m_picHolder.
|
|
|
|
|
I think tempBitmap is deleted when it goes out of scope, which also deletes the gdi resource it's wrapping.
Try adding a CBitmap member variable to your class like:
CBitmap m_bitmap;
then in your function:
{
m_bitmap.LoadBitmap(); // or however you're getting it
m_picHolder.SetBitmap(m_bitmap);
}
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
Now, I am want to use bitwise operation, ex: add 1 or 0 to position in 8_bit. But I don't know about this.
Can you help me?
Thank's lot.
Best regard!
lang tu
|
|
|
|
|
What do you want to do, exaclty ?
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
I need a program that operate with bit.
Example:
unsigned long x;
I want to put 1 or 0 to the 6th bit in x.
Can you help me?
lang tu
|
|
|
|
|
Well, the numbers you want for each bit are:
1
2
4
8
16
32
64
128
256
512
etc.
So, x |= 128 will set the 8th bit. x &= ~128 will strip that bit.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
If you are saying the the eighth bit is the 27 bit you want to be set:
<br />
unsigned int v = 1;<br />
<br />
v |= 1 << 7;
<br />
v |= 1 << 6;
<br />
v ^= 1 << 6;
<br />
v ^= 1 << 0;
<br />
v ^= 1 << 0;
-- modified at 22:46 Wednesday 29th November, 2006
|
|
|
|
|
Set (1) high order bit of a byte:
unsigned char ByTe = 0;
byte |= 0x80;
Reset (0) high order bit of a byte:
unsigned char ByTe = 0x80;
byte &= ~0x80;
|
|
|
|
|
Do vectors or CObArrays (and other similar containers/classes) automatically free their memory when the object containing them is destroyed? In other words, I have a vector as a data member in my class. When my class is destroyed, does the vector free whatever memory it held, or do I have to explicitly do that in my classes destructor?
Thank you,
BP
|
|
|
|
|
I believe the containers allocate space for the collection of types and destroys the memory for all those types. However, if the types are objects that contain dynamically allocated memory, the objects are responsible for deallocating their memory. Also, if the types are pointers to dynamically allocated objects, then you are responsible to write code to deallocate the memory.
|
|
|
|
|
It depends. A vector will dispose of an object, but it will not call delete, if the object was a pointer. So, if the object is a class, and it has a destructor, it will be called. If it's a pointer, the memory will leak if you don't delete it.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Thanks for clarifying what I said! I think I need to stop and go to bed.
|
|
|
|
|
Thanks, I appreciate your responses.
|
|
|
|
|
I would like to know that how to add onTimer in .NET as in VS6.0 with ClassWizard?
Please help!
|
|
|
|
|
Thank you everybody!
I solve the problem now!
|
|
|
|
|
LaHaHa wrote: Thank you everybody!
You're welcome!
|
|
|
|
|
#include <string.h><br />
#include <stdio.h><br />
<br />
char string[] = "A string\tof ,,tokens\nand some more tokens";<br />
char seps[] = " ,\t\n";<br />
char *token;<br />
<br />
void main( void )<br />
{<br />
printf( "%s\n\nTokens:\n", string );<br />
<br />
token = strtok( string, seps );<br />
while( token != NULL )<br />
{<br />
<br />
printf( " %s\n", token );<br />
<br />
token = strtok( NULL, seps );<br />
}<br />
}<br />
that is straight from msdn it does what i need but
char string[] = "A string\tof ,,tokens\nand some more tokens";
i need that line to take the text from a edit box in the form of a CString and i dont know how to do it.
|
|
|
|
|
The EditBox has a GetWindowText method, which returns a CString. CString has a GetBuffer method that you can use to get a char *, which is the same as a char[].
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|