|
Can you more about your project maybe you dont need to use of MFC.
|
|
|
|
|
Hi..
I am running thread..I want to end the thread after 1 minutes..
i am getting the Current time..
i am taking the given time
End Time = Current Time + Given time..
Now i want to end thread after 1 minutes.
plz help me
thank you
manju
Hi..
I am Mnaju.I have Completed my B.E Computers Science.Lokking for a job.I am interested in VC++
manju
|
|
|
|
|
And what is your doubt about? Cannot the thread routine itself monitor such a time interval?
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
|
|
|
|
|
hi..
First i am getting the current time
Example Current Time = 03.00pm
Given time 1 minute.
End Time = 03.01 pm
thread should exit after 03.01pm
but when i comparing CurrTime = EndTime.
The current time is showing 03.00pm
but after 1 minute the current time should be 03.01pm
i cant compare
help me
Hi..
I am Mnaju.I have Completed my B.E Computers Science.Lokking for a job.I am interested in VC++
manju
|
|
|
|
|
manju#123 wrote: First i am getting the current time
Example Current Time = 03.00pm
Given time 1 minute.
End Time = 03.01 pm
thread should exit after 03.01pm
but when i comparing CurrTime = EndTime.
The current time is showing 03.00pm
but after 1 minute the current time should be 03.01pm
i cant compare
help me
(Post) code, please.
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
|
|
|
|
|
It was the algoritm can you make a code for it?
|
|
|
|
|
Since it is (by OP's admission) a buggy algorithm, hence yes, I can implement it.
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
|
|
|
|
|
Hi..
here code.
////////////////////////
cDuration = _ttoi(linfo->sDuration);
StartTime = COleDateTime::GetCurrentTime();
CurrTime = COleDateTime::GetCurrentTime();
CurTime.Format("%02d:%02d:%02d",CurrTime.GetHour(),CurrTime.GetMinute(),CurrTime.GetSecond());
COleDateTimeSpan ts(0,0,cDuration,0);
EndTime = StartTime + ts;
StTime.Format("%02d:%02d:%02d",EndTime.GetHour(),EndTime.GetMinute(),EndTime.GetSecond());
if(linfo->bServerConnected==false)
{
if(CurTime <= StTime)
{
linfo->btimeOut = false;
}
else
linfo->btimeOut = true;
if(CurTime <= StTime)
while(linfo->btimeOut == false)
{
run the thread
if(CurTime == StTime)
{
linfo->btimeOut = true;
ExitThread(dwExitCode);
_endthread();
}
}
//////////////////////////////////////////////////////
thank you
Hi..
I am Mnaju.I have Completed my B.E Computers Science.Lokking for a job.I am interested in VC++
manju
|
|
|
|
|
What a mess!
(1) use <pre> tags to surround code snippets.
(2) You should never use ExitThread.
(3) What is the purpose of _endthread()
(4) What is the purpose of the following lines?
CurTime.Format("%02d:%02d:%02d",CurrTime.GetHour(),CurrTime.GetMinute(),CurrTime.GetSecond());
StTime.Format("%02d:%02d:%02d",EndTime.GetHour(),EndTime.GetMinute(),EndTime.GetSecond());
(BTW how are CurTime , StTime declared?)
(5) A far a I can see CurTime is never updated.
(6) Probably an equality test on times is not appropriate (maybe better >= ).
IMHO we're a bit far from the target.
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
|
|
|
|
|
Hi..
what should i do so that..
current time is updated...
manju
Hi..
I am Mnaju.I have Completed my B.E Computers Science.Lokking for a job.I am interested in VC++
manju
|
|
|
|
|
manju#123 wrote: current time is updated...
That means it is updated inside the thread routine. Could you please post that code (maybe the variable declaration will be helpful too)?
manju#123 wrote: what should i do so that..
Well, code needs a bit refactoring I suppose. We could help.
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
|
|
|
|
|
here code.
////////////////////////
COleDateTime StartTime,CurrTime;
COleDateTime EndTime;
CString StTime,CurTime;
cDuration = _ttoi(linfo->sDuration);
StartTime = COleDateTime::GetCurrentTime();
CurrTime = COleDateTime::GetCurrentTime();
CurTime.Format("%02d:%02d:%02d",CurrTime.GetHour(),CurrTime.GetMinute(),CurrTime.GetSecond());
COleDateTimeSpan ts(0,0,cDuration,0);
EndTime = StartTime + ts;
StTime.Format("%02d:%02d:%02d",EndTime.GetHour(),EndTime.GetMinute(),EndTime.GetSecond());
if(linfo->bServerConnected==false)
{
if(CurTime <= StTime)
{
linfo->btimeOut = false;
}
else
linfo->btimeOut = true;
if(CurTime <= StTime)
while(linfo->btimeOut == false)
{
run the thread
if(CurTime == StTime)
{
linfo->btimeOut = true;
ExitThread(dwExitCode);
_endthread();
}
}
//////////////////////////////////////////////////////
thank you
Hi..
I am Mnaju.I have Completed my B.E Computers Science.Lokking for a job.I am interested in VC++
manju
|
|
|
|
|
OMG, You're comparing strings!
Anyway, I don't see any thread routine in your post.
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
|
|
|
|
|
Hi,
can any body help me how to detect mic location i.e Microphone, Rear mic or any more supported in Sound card in windows XP using mixer APIs.
Pavan
pavan
|
|
|
|
|
Can you more explain,what do you need exactly?
|
|
|
|
|
Dear Friends,
i m working on an VC++ application and using oracle as a backend. Through my application i m writing some data to Oracle database. After certain number of iterations i m getting Commit error (8197). Can anybody help me with this? What might be the reason for the same.
|
|
|
|
|
have you googled for that error number ?
also, have you checked Oracle documentation ?
because this is a VC++ forum, we are not Oracle experts.
|
|
|
|
|
I have tried on Google it is mentioned as it commit error and nothing in detail.. I have asked this question on VC++ forum because i wanted to know if somebody who have worked on VC++ and Oracle in combination may know the reason........
Thank u so much
|
|
|
|
|
Hi there,
You will have a better chance of getting an useful answer to this question at the Database[^] forum.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Hello experts,
I have a project that drive me crazy. I would appreciate if any bony can help/guide me
I have 2 computers both running XP Pro SP2 called PC-A and PC-B.
PC-A is an embedded computer. It has an application to do some specific task. Right now, I have to run it manually and save the results for my other tasks. I do have source for this application.
I have another application on computer PC-B. This application is relying on the results from PC-A which right now I have to enter manually.
These 2 computers are connected via ethernet cable. I do have source for this application as well
I would like to modify the application on PC-B to tell PC-A to run its application and return results to PC-B so PC-B can perform its task automatically.
I don't know where to start.
Please help me out with some direction/links. Example would be perfect
Thanks in advance
|
|
|
|
|
install PsService[^] on the calling machine, then use it like this :
psservice \\192.168.0.15 -u the_user -p the_pwd start the_service
|
|
|
|
|
toxcct wrote: psservice \\192.168.0.15 -u the_user -p the_pwd start the_service
How would the data pass back to the calling machine (PC-B)?
|
|
|
|
|
which data ?
have you tested it ?
here, we use it in all our servers architecture, so, it works well !
if you want more detail about it, maybe you should have a look at the API used by its author :
How it Works
PsService uses the Service Control Manager APIs that are documented in the Platform SDK.
|
|
|
|
|
When my MFC application is run, it invokes a dialog. Though I have removed the OK and the cancel button from the dialog my dialog can be dismissed by pressing the esc key. is there a way to prevent the default behaviour of the escape key to be overwritten.
Also i like to dismiss the dialog by posting a message after some time. how to I post a destroy message to the dialog.
|
|
|
|
|
Hmm, have forgotten how to do they escape key bit, there's a function in one of the MFC classes your Dialog is deriving from that turns Esc into a WM_CLOSE, you need to override that or prevent it being called, a PreTranslateMessage override might be able to do it.
When it comes to closing the Dialog your best bet is probably to use a timer, MFCs timers are fine and when it goes off use PostMessage to have the dialog send itself a WM_CLOSE. Don't use SendMessage or things may go horribly wrong when you return to run code in a deleted dialog.
If the dialog closing is conditional then set your timer to a short period, like a 10/th of a second and check the condition. If it's not met just set the timer again.
"The secret of happiness is freedom, and the secret of freedom, courage."
Thucydides (B.C. 460-400)
|
|
|
|