|
Your project is Win32 type, right?
HWND h = ::GetDlgItem(hYourDlgHandle, IDCANCEL);
::EnableWindow(h, FALSE);
Maxwell Chen
|
|
|
|
|
Thanks chen
yes it working fine
once again thank u
AbidBhat
|
|
|
|
|
Or if you have handle to button you dont need to use of GetDlgItem.
|
|
|
|
|
Hello everyone,
I am reviewing the exception safety of some code and met with some issues about exception safety in string, which I can not find the answer at hand. I think the 3 code segments may all throw exceptions. Because the storage of string internal character data is on heap (using allocator for char?), so when there is low memory, there will be bad_alloc exception?
1. Initialization
string str1 = "Hello";
2. Assignment
string str2 = str1;
3. Empty construction
string str;
I am not quite sure about (3).
thanks in advance,
George
|
|
|
|
|
I believe that the STL string object will not allocate storage until required or directly requested. So #3 should not be expected to throw an exception.
Note, if the string object you are using is doing something extra, such as using a private/high-performance heap, you cannot know if the heap if being initialized when the first string object is instantiated.
Also note - the exception could also be thrown for other reasons, like heap corruption or address space exhaustion, so do not presume that it can be thrown only when you are out of memory.
Peace!
-=- James Please rate this message - let me know if I helped or not!<hr></hr> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Thanks James,
1.
James R. Twine wrote: I believe that the STL string object will not allocate storage until required or directly requested. So #3 should not be expected to throw an exception.
I am using Visual Studio. I am interested to find more information about whether in my specific version of STL implementation, for empty string, whether there will be any space allocation. But in file string, there is no constructor for basic_string. Do you know where to find it? (I believe I should look at the constructor for string, which is the same as the constructor for basic_string)
2.
James R. Twine wrote: heap corruption
Is it structured exception or C++ exception? I belive it is structured exception. But I am talking about C++ exception.
3.
James R. Twine wrote: address space exhaustion
You mean we reserved a lot of space in virtual memory, but not commit?
regards,
George
|
|
|
|
|
George_George wrote: I am using Visual Studio. I am interested to find more information about whether in my specific version of STL implementation, for empty string, whether there will be any space allocation. But in file string, there is no constructor for basic_string. Do you know where to find it? (I believe I should look at the constructor for string, which is the same as the constructor for basic_string)
I am not sure which version of VS you are talking about, but I am sure a simple find in files will locate it for you.
George_George wrote: Is it structured exception or C++ exception? I belive it is structured exception. But I am talking about C++ exception.
AFAIK, that would depend on the type of heap corruption. Your heap could br corrupted such that it thinks that there are no more free blocks avaialble (if you use a non-growable heap), or its internal structured could be fulblungered such that when the heap code tries to use/evaluate them, it causes a crash.
George_George wrote: You mean we reserved a lot of space in virtual memory, but not commit?
That is one way. Another easier way is to not clean up worker threads correctly so that their stack space is not reclaimed. Or if you have a large file mapped into memory, etc.
Peace!
-=- James Please rate this message - let me know if I helped or not!<hr></hr> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Thanks James,
1.
James R. Twine wrote: I am not sure which version of VS you are talking about, but I am sure a simple find in files will locate it for you.
I am using Visual Studio 2008, any ideas?
2.
James R. Twine wrote: AFAIK, that would depend on the type of heap corruption. Your heap could br corrupted such that it thinks that there are no more free blocks avaialble (if you use a non-growable heap), or its internal structured could be fulblungered such that when the heap code tries to use/evaluate them, it causes a crash.
I think you mean some meta data of heap, e.g. free space size of the heap is corrupted (so that the actual free memory size is not reflected), then when we allocate later, there will be bad_alloc exception?
regards,
George
|
|
|
|
|
George_George wrote: I think you mean some meta data of heap, e.g. free space size of the heap is corrupted (so that the actual free memory size is not reflected), then when we allocate later, there will be bad_alloc exception?
I do not know of any standard heap that readily knows how much free space it has available, and even if it did, it might be useless information. For example, if a heap has 100 1MB free blocks available, but they each have a used block in-between them, then while the heap has 100MB available, only 100MB could be allocated in a contiguous block.
the heap's internal data structures could be corrupted such that it cannot find the next free block (no pointer to the next free block), which would make it think it is out of memory. Or it could point off to random memory location, which could cause a crash, or try to give you memory that was still in use. Lotsa fun things can happen with heap corruption.
Peace!
-=- James Please rate this message - let me know if I helped or not!<hr></hr> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Thanks James,
My question is answered.
regards,
George
|
|
|
|
|
Hi all
can any one kindly tell me how to compile our vc++ program by comandline.
Thanks and Regards
#sanroop#
|
|
|
|
|
Open a Visual C++ IDE window. From Tools | Visual Studio Command Prompt to get the DOS-box.
Maxwell Chen
|
|
|
|
|
|
Dear all
I need to know whether printer support "Job Retention" (Job Storage) feature or not, ie whether printer can store the jobs so that they can be printer later by issuing a password to printer control panel. (Different options for job storage are "Hold and proof", "Private Job", "Quick copy" etc.
To know all these information I tried WMI in windows, various vc++ printer capabilities APIs without any luck.
Is there some way so that I can get all these information.
please help..
Regards
Shobhit Jain
|
|
|
|
|
Hi to ALL...
i have one doubt regarding to my project ...i have one compiled socket source code .In this source code are fully worked Windows XP...but in this code is not suitable for vista(not compiled)..
what is the problem for this ?
Whats the solution for that?
Is there any DLL corruption or not?If it is yes what kind of DLL add that problem ..?
....Please give your suggestion or any URL ...
*****THANKS N ADVANCE****
Mathen.K
(I WILL TRY MY LEVEL BEST )
|
|
|
|
|
Please don't spam the whole site. Is your code in C++, or C# ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi thanks to your replay...As my code is C++..
*****THANKS N ADVANCE****
Mathen.K
(I WILL TRY MY LEVEL BEST )
|
|
|
|
|
rowdy_vc++ wrote: As my code is C++..
Then why did you post your question in the C# forum and the Vista forum as well? What's behind your stupid behavior? Are you having a problem reading or understanding?
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
rowdy_vc++ wrote: Is there any DLL corruption or not?If it is yes what kind of DLL add that problem ..?
I guess in your case, most probably dll corruption does not induce compilation error.
what are all your compilation error, doesn't it gives hint to the problem?
|
|
|
|
|
Hi Friend Thanks to your Replay....Actually Mr .Rajukuma its not displaying any error ...the output of our project is one kind GUI.In Windows XP when i Clicked that application its worked ..At the same time In Vista i Clicked that application its suddenly terminated ...this is my problem!!!!
*****THANKS N ADVANCE****
Mathen.K
(I WILL TRY MY LEVEL BEST )
|
|
|
|
|
|
Thank u Very much Mr .RajKuma
*****THANKS N ADVANCE****
Mathen.K
(I WILL TRY MY LEVEL BEST )
|
|
|
|
|
|
Thanks to your replay..Actually Mr.Hamid the beauty is that is no error displayed ..when i am clicked the event ..that event was terminated..thats all!!
*****THANKS N ADVANCE****
Mathen.K
(I WILL TRY MY LEVEL BEST )
|
|
|
|
|
So I think you need to review your project for vista.
|
|
|
|