|
anselmo wrote: Another thing that makes me think is why in w2003 works, if the
#include "commctrl.h" nor the link to comctl32.lib where added previously.
Those need to be there for your project to compile and link.
At runtime, however, ComCtl32.dll needs to be loaded. That's all InitCommonControls does - makes
a call into the DLL which forces it to be loaded if it isn't already. That's why I think if
it worked on 2003, that a system DLL causes the ComCtl32.dll to be loaded so it's already there
when you create your controls.
Glad it worked!
Mark
"Go that way, really fast. If something gets in your way, turn."
|
|
|
|
|
Hi,
I have placed a static Text Common control, can i set the alignment of text present in that text box, I have found right align text option but couldn't find center alignment option, does any one know about it.
Warm Regards,
Mushq
|
|
|
|
|
If you placed it on a dialog in the resource editor, then select the control, press F4 to get the
properties window for the control. Find the Align Text property - you should be able to set it
to left, center, or right.
For a programmatically-placed control, add the SS_LEFT, SS_CENTER, or SS_RIGHT style when creating
the control.
Mark
"Go that way, really fast. If something gets in your way, turn."
|
|
|
|
|
Mark Thanx a lot
|
|
|
|
|
Dude you broke the forum again
|
|
|
|
|
It was broken when I got here
Nobody saw it - you can't prove anything!
"Go that way, really fast. If something gets in your way, turn."
|
|
|
|
|
Reply posted to your message[^] below.
Iain.
|
|
|
|
|
Is there any STL container for array?
|
|
|
|
|
the std::vector is a dynamic array.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
If you are looking for a static size array, there is also boost::array[^].
Extra note: boost::array is in TR1[^], so if VC++ supported it, you could have used std::tr1::array by including "tr1/array" (this works in gcc), but until then, if you decide to use boost, you can include "boost/tr1/array.hpp" and use std::tr1::array (instead of boost::array).
Orhun Birsoy
|
|
|
|
|
How can I ensure that the memory allocated by new gets deleted even if if do not give a delete operator.
|
|
|
|
|
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
They'll manage deletion of the memory for you. But use it only when you need them, not putting them everywhere just because you are lazy
|
|
|
|
|
tom groezer wrote: even if if do not give a delete operator.
what does "give a delete operator" mean? "give" is not a standard term used in software development. Here is a tip, don't make up your own terms when posting messages as it will be difficult to understand what you are saying.
Here is what you can do with a delete operator:
* overload
* call
Which one are you speaking about?
|
|
|
|
|
u call delete as in delete p;
|
|
|
|
|
Ok
tom groezer wrote: How can I ensure that the memory allocated by new gets deleted even if if do not call a delete operator.
Then Cedric has given you the correct lead to the smart pointer[^]. However there are different models of smart pointers. There is one in STL called "auto_ptr" and there are others in the Boost library[^] that have different use models.
I recommend that you feel confident in your understanding of the different models before attempting to use them. Misuse of smart pointers can be worse than leaking memory.
|
|
|
|
|
If a base class has private functions how does the derived class call it without use of friends. is there some idiom where u can acess the private function of base class. Also is there a difference between a function and a method.
|
|
|
|
|
tom groezer wrote: If a base class has private functions how does the derived class call it without use of friends.
That's why C++ has the 'protected' keyword: your inherited class will be able to access the function but other classes won't be able to call it.
tom groezer wrote: Also is there a difference between a function and a method.
It is just a 'naming' convention: a function is considered to be a global function and a method is a member function of a class.
|
|
|
|
|
tom groezer wrote: is there some idiom where u can acess the private function of base class.
No, because it would not serve the purpose of having them private instead of protected.
Declaring members as private in a base class is to guard both variables and functions from being accessed and misused. They are used internally and the developer that designed the base class declared them private to guard against misuse.
I consider private declared base class members a powerful tool in order to make sure the class is used in the way it is supposed to be used. I think if someone feels the need for accessing private members of the base class there's a 5% chance the designer of the base class has made an error, but 95% chance that someone is trying to use the class in a way it wasn't supposed to.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Can inline functions be inherited? How?
|
|
|
|
|
I think you are talking about classes
Yes. inline functions can be inherited.
inline functions can be defined in two ways.
1) functions defined with class declarations are by default inline.
2) if you defined the function to be inline in cpp files then those functions cannot be accesed outside its visibility.
Best Regards
Raj
|
|
|
|
|
Hi all,
I have developed one small application in VC++ using Visual Studio
I am going to fix memory leakages occurred in my program in the following code
char *m_tmpChar;
m_tmpChar=new char[100];
m_tmpChar="0";
now when I am going to delete this object with delete [] m_tmpChar it is showing me error dialog saying that assertion failed _crtisvalidheappointer(pUserData)
anyone please help me to solve this problem????
|
|
|
|
|
You can't copy a char arry using =. You need to use strcpy for that purpose.
What you are doing here is storing the address of a new string in m_tmpChar. This memory was not allocated with new so you get a crash when you try to delete it.
|
|
|
|
|
char *m_tmpChar;
m_tmpChar=new char[100];
m_tmpChar="0";
delete [] m_tmpChar;
That's because you're making a fundamental mistake. m_tmpChar is not some magic string type - its a pointer to a character.
In line 2, you allocate a patch of memory big enough for 100 chars, and make m_tmpChar point there.
In line 3, you make that variable point to another patch of memory that holds the character '0' followed by a NULL. This might even be read only, depending on complier settings. In the process, you've forgotten where your recently allocated lump of 100 bytes was.
In line 4, you are asking delete to free the "0" patch of memory, which certainly wasn't created by new . As you are in debug mode, you are getting errors.
So you have 2 bugs - (a) deleting memory which wasn't created with new [giving you the fault], and (b) not deleting memory that *was* created by new [giving you the leak].
That was the long explanation. The short explanation:
Ask your teacher about strcpy , or read your lecture notes.
Pointers are one of those bits of learning that is really strange and bizarre, until it all clicks in your head. Then its just dangerous if you're not careful.
Iain.
|
|
|
|
|
This is my complete code
char *m_tmpChar;
CString temp = m_list.GetItemText(0);
m_tmpChar="1";
RegSetValueEx(hCurKey,"",NULL,REG_SZ,(unsigned char*)m_tmpChar,strlen(m_tmpChar)+1);
Now in the above code it shows me Linkage error
So can you please give me solution with strcpy function
Thanks again!!!!!!
|
|
|
|