|
vikrams wrote: Is there any problem?
None that I know of. Once CloseHandle() has closed the last handle to an object, the object is removed from the system.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I'm setting the check state in the treeview but after the treeview becomes visible for the 1st time, nothing is checked.
If I do the same operation after the treeview is visible, everything works fine.
How can I get the treeview to correctly display the checked states the first time around? I've even invalidated the treeview window, called UpdateWindow, and RedrawWindow with no success.
TIA
---
Yours Truly, The One and Only!
web: devmentor.org
Design, Code, Test, Debug
|
|
|
|
|
I was able to find the problem and fix it, just needed to add an image list!
---
Yours Truly, The One and Only!
web: devmentor.org
Design, Code, Test, Deploy
|
|
|
|
|
Hi all,
I have made a simple dialog based application, in which i have made a next button and on that button click i m showing a progress bar and then performing some different operations. Now what i want is that my progress bar should start running and as soon as i press next button and should stop as soon as task is fnished...But my problem is it finishes the task first and then shows the progressbar....how should i solve this
thanks in advance
|
|
|
|
|
IMHO the simplest way will be making the 'different operations' code responsible to update the bar progress.
You can also use threads but it may become a little harder.
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.
|
|
|
|
|
put timer to show progressbar in active mode!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/codeProject$$>
|
|
|
|
|
The problem is that your "different operations" are bogging down the primary thread thus leaving no room to update the UI. Do your work in a secondary thread, and post "update" messages back to the primary thread (i.e., the one that owns the UI).
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hello everyone,
In the following code, how GetArrayLength(arr1) is matched to template function size_t GetArrayLength(const T(&arr)[size])? My confusion is how arr1 is matched to const T(&arr)[size]? I have tried to change const T(&arr)[size] to const T(arr)[size]) but it does not work.
template<size_t size,="" typename="" t="">;
size_t GetArrayLength(const T(&arr)[size])
{
return size;
}
int main()
{
char arr1[] = "Hello World";
std::cout << GetArrayLength(arr1) << std::endl;
return 0;
}
</size_t>
thanks in advance,
George
|
|
|
|
|
|
Hi Matthew,
Could you answer from your points, how they are matched please?
BTW: I have the C++ Programming Language book at hand, but from section 13.3 (Function Template), I can not find the answer to my specific question.
regards,
George
|
|
|
|
|
George_George wrote: I have the C++ Programming Language book at hand, but from section 13.3 (Function Template), I can not find the answer to my specific question.
This in itself is a pretty good clue that what you're wanting to know is a)obscure and b)probably compiler dependent. I'm afarid I don't know enough about modern compilers, despite having written analogues of most of the parts, to even take a good guess at how template parameter matching happens. One thing is almost certain, there will be priority orders established in terms of parameter positions, and matching against type modifers. This sort of prioritization is often dived into categories like is there a strong match (exact type equivalence), if not is there a weak match (different only by type one modifier) and then there'll be a priority order, or classification, of type modifers to determine which weak matches are tried first.
Compilers are beastly complicated and facinating things. If you want to get a really good idea of how they work look for something known as The Dragon Book, it's the bible of compiler writers (I never made it more than half way through )
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Thanks Matthew,
Your answer is general and it is appreciated if you could provide some ideas of how in my question the function prototypes and functions are matched.
regards,
George
|
|
|
|
|
Hi Experts,
What is mean by this statement ?
<br />
inline CMyClass& GetTreeCtrl()
{<br />
return m_shellTree;<br />
}<br />
|
|
|
|
|
inline means that the function is inlined (the compiler will replace a call to the function by the code of the function itself). Search for inline on google
The & means that the function returns a reference to the object instead of a copy of the object. By default, in C++ when you pass arguments to a function, you will in fact have a copy of the object, not the original object. The same with the return of the function: you will get a copy of the object. By using the reference, it means that you will get the original object, not a copy (so, if you modify it outside the class, it will be modified in the class also).
But I think your code is wrong: you forgot the class name (or is does it come from a header file ? If yes, the inline is not needed).
|
|
|
|
|
returning the variable by reference!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/codeProject$$>
|
|
|
|
|
Hi Friends,
I am doing a UNICODE project,
Here i am using wchar_t * variable and i am taking name of the file from CString.GetBuffer().
Here i am getting the error C2440: 'initializing' : cannot convert from 'char *' to 'unsigned short *'
Please help me. Its urgent....
|
|
|
|
|
First, never ever use GetBuffer without having read the documentation. CString has casting operator so that you don't have to use GetBuffer. You should only use this function if you want access to the internal buffer of the CString. Read the doc carefully if you don't want nasty surprises in your code.
You should prefer the use of TCHAR instead of char or wchar. This way, everything is either char or wchar depending on the UNICODE settings and you don't have to worry about conversions.
Now, maybe you'll still need a conversion: what are you doing with this wchar string ?
|
|
|
|
|
santhoshv84 wrote: I am doing a UNICODE project,
Sure?
santhoshv84 wrote: Here i am getting the error C2440: 'initializing' : cannot convert from 'char *' to 'unsigned short *'
Probably you aren't doing a UNICODE build. check if the _UNICODE preprocessor symbol is defined for your project.
BTW: probably you don't need either to access CString internal buffer, hence avoid to call GetBuffer method.
BTW 2: maybe better to use generic text data, i.e. TCHAR insted of w_char .
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.
|
|
|
|
|
Hi all, I am developing one application. In that i have created on report file which contains tables, titles and tree view list also by using HTML tags. I am opening this file in my application it self as another window.
There is no problem in opening this file if the file is small. If the file is big(here i mean to say if number of tables present in this file)then while opening this file my application is displaying a message "Cannot create unique tag, giving up". I am unable to understand this messages.
Can any one please tell me how to avoid this ???
|
|
|
|
|
Well, if you're developing the application, do a search for "Cannot create unique tag, giving up", then put a break point there, and see why it reaches that code?
We have no clue why you wrote that error message. Only your past self, and an examination of your code while it runs can help you.
Iain.
|
|
|
|
|
When numbers are larger than 15 significant figures the function atof() is losing precision. For example:
double dVal = atof( pszValue ); // where pszValue holds the string "1111111111111111"
dVal ends up with 1.11111111111111e+15 which equates to:
1111111111111110
Can anyone suggest a safer way to convert the char* to a double?
|
|
|
|
|
That's because atof returns a float (guess what the 'f' in the function name stands for ?). You could try by using stringstream from the STL:
stringstream ssVal;
double dValue;
ssVal << pszValue;
ssVal >> dValue;
Don't forget to #include <sstream> and to put using namespace std; at the top of your cpp file.
Forget what I say, I wasn't awake . If you look at the range of a double, you'll see that the accuracy (here)[^] is 14 or 15 digits. Your string contains much more digits than that. Now, if the number that you want to represent is an integer value, why don't you use an __int64 instead ?
But, I have a question: why do you need such an accuracy, why is it important ? In most of the cases, you won't need that accuracy.
|
|
|
|
|
Cedric Moonen wrote: That's because atof returns a float
yeah that's what I thought about too. Until I saw this in MSDN[^]. Why not name it atod in the first place?
|
|
|
|
|
Yeah, I realized that just after I posted. I updated my answer already.
|
|
|
|
|
Hello,
I have created one MFC Application for User login page. I have created 2 dialog boxes. One dialog box contains username and password, when i press Create new account button, there is another dialog box will open. There i have given the username, password and confirm password.
The problem is if i click the submit button in 2nd dialog, only one character has to be stored in the file.
I want to store the entire text in the file.
How can I do that?. Please help on this.
Thanks in advance.
|
|
|
|