|
You got the selected indeces in aryListBoxSel; and you are using your own index, i for getting the selected text where i varies from 0 that i swhy you got the first 5 items. you have to use some thing like m_listbox.GetTextLen(aryListBoxSel[i]), m_listbox.GetText(aryListBoxSel[i],str.GetBuffer(n));
|
|
|
|
|
thanks a lot. a simple mistake costed me a lot of time.. better late than never.. thanks anyways.
|
|
|
|
|
Doubts again,
I was telling u that i have to merge the selected files. i know that i can use CFile to do the reading and writing of files. but when we select the file how do we store each file name? when i tried to use the array its giving me an assertion error.
|
|
|
|
|
Except DlgDirList you can use of FindFirstFile/FindNextFile.
|
|
|
|
|
I followed the tutorial here [^]:
create the driver service and start it if created successfully. After creating or open the service successfully,it start the service failed. I use GetLastError and find the error code is 2.
I don't know why,and how to fix it?
Regards.
|
|
|
|
|
Before asking a question here you should really spend some time trying to debug the problem.
What happens if you attempt to debug it ?
Error code 2 = The system cannot find the file specified.
regard,
Jonathan
|
|
|
|
|
Of course I did. I know what error code 2 means.
But the real problem is that,the file(example.sys) does exist.
Regards
|
|
|
|
|
Look in the registry and check what the entries added by the SCM look like. The ImagePath entry is probably not correct.
Judy
|
|
|
|
|
Hello everyone,
When we use OLESTR to allocate a variable from string literal, like OLESTR("Hello World"), the memory space for the string literal is on stack, right?
I can not find official document for this from MSDN.
thanks in advance,
George
|
|
|
|
|
George_George wrote: When we use OLESTR to allocate a variable from string literal, like OLESTR("Hello World"), the memory space for the string literal is on stack, right?
Nope, String literals don't follow the lifetime rules of the variables allocated on the stack. AFAIK they are always allocated on read-only memory.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Thanks CPallini,
So, we can feel free to pass the OLESTR pointer, which points to an OLESTR allocated in one function to another function (I mean passing the address of OLESTR string literal)?
regards,
George
|
|
|
|
|
Yes.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Cool, CPallini!
Question answered.
BTW: do you have any support document which declares OLESTR string literal is in global read-only memory other than stack memory?
regards,
George
|
|
|
|
|
technically, yes, with your VC compiler. however, you should know that it's only because of the optimizer, and some other compilers may not behave identically. so I'd say not to make such assumptions then...
|
|
|
|
|
Thanks toxcct,
1.
Do you mean when we enable string pooling, OLESTR string literal will be in global read-only memory, and it is safe to pass from one OLESTR pointer pointed to string allocated in one function to another function.
2.
If we do not enable string pooling, OLESTR string will be in stack, and above operation is not safe?
3.
You always treat OLESTR in stack? Other than in global accessible memory area?
regards,
George
|
|
|
|
|
I won't answer each specific question, because as I already said in my previous post, all this is compiler/optimizer specific, and the C++ standard does dictate a single behavior for that...
|
|
|
|
|
I am more interested in which option in MSVC could be used to control such optimization? The string pooling option?
regards,
George
|
|
|
|
|
George_George wrote: I am more interested in which option in MSVC could be used to control such optimization?
Why ?
|
|
|
|
|
Thanks toxcct,
Because I am reading code which pass pointer to string literal allocated in one function, to another function.
I want to know,
1. whether it is safe code?
2. If not, how to make it safe, by turning on string pooling? (I want to save my efforts to rewrite all such code if it is unsafe).
regards,
George
|
|
|
|
|
if you're sticking to MSVC, you can assume it is (as i said in my first post !!)
|
|
|
|
|
Thanks, toxcct!
Good to know you think I am correct this time.
regards,
George
|
|
|
|
|
I think it is always safe (i.e. it maybe unsafe only for not-standard compilers).
Only write access to string literal buffer gives unpredictable results, see, for instance,
[^].
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Thanks CPallini,
1.
CPallini wrote: I think it is always safe (i.e. it maybe unsafe only for not-standard compilers).
Do you have any documents support this claim? Even if we turn off string pooling?
2.
I read your referred article, I think it has nothing to do with OLESTR, but dealing with write to const data? Right?
regards,
George
|
|
|
|
|
George_George wrote: Do you have any documents support this claim? Even if we turn off string pooling?
C++ specifications? See below.
George_George wrote: I read your referred article, I think it has nothing to do with OLESTR, but dealing with write to const data? Right?
You're wrong.
First of all OLESTR are string literals [^].
Have you read "Const Storage and String Literals" section, it reports the following excerpt:
The C++ standard (section lex.string) states:
1 A string literal is a sequence of characters (as defined in
_lex.ccon_) surrounded by double quotes, optionally beginning with the
letter L, as in "..." or L"...". A string literal that does not begin
with L is an ordinary string literal, also referred to as a narrow
string literal. An ordinary string literal has type "array of n const
char" and static storage duration [...]
Static storage duration means that memory for literals is allocated when the program begins running and is freed when the program terminates.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Thanks CPallini!
Question answered. You are so knowledgable.
regards,
George
|
|
|
|