|
Hi,
I have a program where I need to check whether 10s has elapsed before setting something to failed.
I have used clock().
Unfortunately, if the real time updates (for whatever reason e.g. I manually change the clock from 10:30 to 11:30), clock() updates too thereby causing my code to flag an error as it thinks more than 10s has elapsed.
Does anyone know of a way that I can check the elapsed time so that any changes to the real time don't affect it?
I hope that made sense!
Thanks in advance.
|
|
|
|
|
|
Thanks, I've just looked that up in the help and that's exactly what I'm after.
Thanks alot!
|
|
|
|
|
Hi ,
I have a CStringList that contains some filepaths, these paths need to be passed into a function:
eg: GetNewXML(LPTSTR PreviewFileArray[],int count)
How can I construct a LPTSTR array from CStringList?
thanks
|
|
|
|
|
Are you sure that you really need LPTSTR (don't you need LPCTSTR)?
As stated, you probably have to copy all the strings.
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.
[my articles]
|
|
|
|
|
sorry, what do you mean "copy all the strings. "?
can you provide me a code? thanks
|
|
|
|
|
Yes the function prototype implies such copy.
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.
[my articles]
|
|
|
|
|
however, I can't initialize the array like this:
LPTSTR[] files = new LPTSTR[count];
do you mean copy character by:
LPTSTR a = list.GetAt(0).CopyChars?
|
|
|
|
|
azusakt wrote: LPTSTR[] files = new LPTSTR[count];
change to
LPTSTR* files = new LPTSTR[count];
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.
[my articles]
|
|
|
|
|
Or another suggestion (if you can change the function signature): just pass the string array as a constant reference instead.
void GetNewXML(const CStringList& myList);
You wrote the GetNewXML function ?
|
|
|
|
|
sorry that I can't change the interface for function "GetNewXML", coz it has been written by pervious staff.
so I trying to do, but not work
/*
LPTSTR[] files = new LPTSTR[count];
for(int i=0; i< count ; i++)
{
files[i] = bmpList.GetAt(i).GetBuffer();
}
*/
|
|
|
|
|
Well, in principle, you can do the really weird thing you suggested:
LPTSTR* files = new LPTSTR[count];
for(int i=0; i< count ; i++)
{
files[i] = bmpList.GetAt(i).GetBuffer();
}
GetNewXML(files, count);
for(int i=0; i< count ; i++)
{
files[i] = bmpList.GetAt(i).ReleaseBuffer();
}
delete [] files;
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.
[my articles]
|
|
|
|
|
I think you didn't really understand what the function accept: the function doesn't accept an array of strings, but one single string (and the count argument is the size of this string). So, you need to pass each string separately. Basically, what you'll need to do is loop through your string array, create a LPTSTR array of the size of the string and pass it to your function, then delete it.
That's completely stupid because if your previous team would have been smart enough so that they passed the string as a constant (LPCTSTR instead of a LPTSTR), then you wouldn't have to create a new string buffer, copy the string in it, pass it to the function and delete it. You would just have to pass the CString object (and it would have been automatically converted).
Oops, I forgot the [] after the first argument . So, forget what I said...
|
|
|
|
|
What a mess a pair of brackets can do...
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.
[my articles]
|
|
|
|
|
Hello Friends,
I need to know how to check weather a push button is enabled or disabled in Win32 API ?
|
|
|
|
|
|
Hi Thanks for the reply. i got the solution.
|
|
|
|
|
about this article: http://www.codeproject.com/KB/system/inject2exe.aspx[^]
can i resize the code section of a PE file?
for example: i want to add 100 bytes(fill with 0x90) end of the code section.
i change values of "SizeOfRawData" and "VirtualSize" for Code Section header. and i change values of "PointerToRawData" and "VirtualAddress" for next sections.
but the new PE file don't execute.
Zo.Naderi-Iran
|
|
|
|
|
I would think you're more likely to get an answer by posting on the message board of that article.
For anyone here to answer, they'd have to know all about it, or download it and research it. The first is unlikely, the next is near impossible.
Good luck,
Iain.
Iain Clarke appearing by Special Request of CPallini.
|
|
|
|
|
But i have expedience for my work ...
Zo.Naderi-Iran
|
|
|
|
|
Hi Iain,
I'm happy you're still appearing by my Special Request.
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.
[my articles]
|
|
|
|
|
Are you trying to write a virus?
Steve
|
|
|
|
|
no, i want protect my PE file.
in first step this is my problem.
please help me
Zo.Naderi-Iran
|
|
|
|
|
What you are asking is extremely low level and involved. Not the sort of thing you can expect answered in a short message board post.
Steve
|
|
|
|
|
Actually yes, but don't tell anybody!
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.
[my articles]
|
|
|
|