|
Thanks will bother u more if I would need some help.
dolly,
N,IN
|
|
|
|
|
You're welcome.
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
[My articles]
|
|
|
|
|
Any sample application for this threading?.
|
|
|
|
|
You are her alter ego, aren't you?
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
[My articles]
|
|
|
|
|
Sir i realy need some sample appln.
|
|
|
|
|
AFAIK, the search functionality is still active on this site. Just type "Threading" in the Search box and you will get lots of links to articles related with Threading.
Another good place to search for is here[^]
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
But remember that the functionality of a timer is not very precise, ie it may or may not fire always after some specified time interval. SO unless you are building something that needs accurate value feel free to use a timer to set the value of the flag to false.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
So, what should we use if timer is not that efficient and reliable.
If I mean that i need to kill my thread after 1 min...1 min means 1 min...
viz. accuracy of time should be there, without fail.
dolly,
N,IN
|
|
|
|
|
You can extend anshuman's solution.
you need not implement timer
Check the following code
ThreadB()
{
DWORD nInterval = 36000;
DWORD nTime = GetTickCount();
flag=false;
while(flag==false)
{
...
..//Code that will do ThreadB monitoring or whatever.
if((GetTickCount()-nTime)>=nInterval)//nInterval can be set to whatever time you need.
flag=true; //This will cause both threads to terminate.
}
I hope it makes sense.
Kindly read about GetTickCount() function before you calculate the your required timeout.
Regards,
Sandip.
|
|
|
|
|
thanks so much sandeep, I am looking into the solution you gave!
Dolly,
N,IN
|
|
|
|
|
Do we have some function to check if a thread is running or not!
Actually i need to check it, before terminating the thread.
Becuase if the thread has already completed its tasks, so no need for another thread to monitor the first thread till a particular fixed period of time!
dolly,
N,IN
|
|
|
|
|
Do we have some function to check if a thread is running or not!
Actually i need to check it, before terminating the thread.
Becuase if the thread has already completed its tasks, so no need for another thread to monitor the first thread till a particular fixed period of time!
Language : c
dolly,
N,IN
|
|
|
|
|
dolly wrote: 1 min...1 min means 1 min...
Well exactly 1 minute is impossible (PC s cannot achieve picosecond precision, for instance), anyway if you set 1 minute timer you maybe confident it will expire before the 61 th second.
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
[My articles]
|
|
|
|
|
ya...I used GetTickCount()....and it's working upto the precision I need.
Will fire more questions if I would need to!
Thanks you friends for helping me out!
Regards!!
dolly,
N,IN
|
|
|
|
|
New
I traced the code in CMFCPropertyGridProperty, and find what is wrong is like this:
CString s;
s.Format(_T("%f"), 1166.7800f);
MessageBox(s);
It displays 1166.780029 on my machine.
How to solve this problem?
=============================================================================
construct like this
CMFCPropertyGridProperty prop(_T(""), COleVariant(f));
When I add the following data:
f = 2.803f;
f = 14419.788f;
The first one is ok, is display 2.803000.
The second one got a problem, is displays 14419.788086.
How to solve this? Thanks.
modified on Wednesday, June 25, 2008 2:49 AM
|
|
|
|
|
I guess that this is a problem of the data conversion from float to string.
Use a double.
Greetings from Germany
|
|
|
|
|
I've the following code snippet which adds Property page
objects cPropPg1Obj and cPropPg2Obj in the property sheet
cPropSheetObj.
CPropertySheet cPropSheetObj;
CPropPg1 cPropPg1Obj;
CPropPg2 cPropPg2Obj;
cPropSheetObj.AddPage(&cPropPg1Obj);
cPropSheetObj.AddPage(&cPropPg2Obj);
cPropSheetObj.DoModal();
Is there a way where I could add/embed a property sheet (say
cPropSheetObj2) as a whole which contains property pages
cPropPg3obj and cPropPg4obj in the property sheet
cPropSheetObj.
|
|
|
|
|
It is a bad idea, because the GUI gets too complicated.
Yes there is a way. You can implement a tab control in the wanted page and than show some controls/dialog.
Or make a sub dialog after a button.
Better sort the wanted functionality with an other methology.
Greetings from Germany
|
|
|
|
|
|
I just stumbled upon a very weird problem and I just can't figure out why this happens. Basically the code I am talking about looks like this:
bRet = ToBool(::CreateProcess(
NULL,
strCmdLine.GetBuffer(strCmdLine.GetLength() + 1),
NULL,
NULL,
m_bInheritHandles,
(m_bCreateNewConsole ? CREATE_NEW_CONSOLE : 0),
NULL,
(strCurDir.IsEmpty() ? NULL : strCurDir),
&si,
&m_processInfo
));
I think it's pretty clear what it does, and there is nothing special about it. The problem lies in the strCurDir parameter. CreateProcess will fail if the directory you specify doesn't exist or is otherwise invalid. Ok... it exists, that's for sure (there is another function that takes care of this). So I just check if one was specified and pass this one, or NULL otherwise. Pretty simple. Though it doesn't work. Even if the string is empty, something (invalid) is passed to CreateProcess. I suppose that an empty string instead of zero is passed, as I could exclude all other possible problem-sources.
Anyone has an idea why this is failing? I added a simple workaround, but still... I'd like to know why it fails.
|
|
|
|
|
And what did GetLastError() returned?
|
|
|
|
|
267, Invalid directory. I know that the problem is the passed directory; setting it to NULL "fixes" the problem. Trust me that I pinned it down as much as I could and excluded any other possible problems.
|
|
|
|
|
Could you pass that directory to the PathFileExists() function and check what it returned?
|
|
|
|
|
As I said, the string is empty. A previous function, which is used to set the directory variable, checks whether the directory exists or not and empties the string otherwise. Again, I excluded all possible problem sources - it is just not "that easy". I still believe that it is a compiler bug (and it fails in both Debug and Release builds, so I guess it's not just a strange optimization...).
|
|
|
|
|
lpCurrentDirectory
[in] Pointer to a null-terminated string that specifies the current drive and directory for the new process. The string must be a full path that includes a drive letter. If this parameter is NULL, the new process will have the same current drive and directory as the calling process. (This feature is provided primarily for shells that need to start an application and specify its initial drive and working directory.)
An empty string would be wrong for this parameter, as you've said yourself.
I'd be tempted to do something like:
LPCTSTR szDir = strDir.GetLength () ? strDir : NULL;
and use szDir in your CreateProcess call - that'll make it easier for your debugging to verify what you're passing to the function.
If the directory really exists, try using filemon from www.sysinternals.com to see what checks windows does on the directory. Maybe is has to not only exist, but have some permissions set? Maybe it has to be readable by the current user?
Iain.
Plz sir... CPallini CPallini abuz drugz, plz plz help urgent.
|
|
|
|