|
That's fine, but please make sure that you provide all the necessary information with your query, so that it would be easier for others to help you.
You said there was an error, but did not say what it was. Take care of these things in the future.
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
O.k Thanks for the Suggestion !!!!!
|
|
|
|
|
In addition to what Rajesh said, I would also advice you not to use SMS text while posting messages here.
Regards,
Vijay.
|
|
|
|
|
phanindra varma wrote: It wasa giving an Error.
Turn your monitor around so we can see it.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
|
How much I love your comments.
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
Rajesh R Subramanian wrote: How much I love your comments.
"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/xml>
|
|
|
|
|
You have powrful eyes.
|
|
|
|
|
Hi All
I am useing timer.And that timer i am calling function FolderCopy().Which is working but after 2min code is hange.I havn't figure out what's a exactaly problem.Code is here.OnStartTimer i am calling in
OnInitDialog()
void CAbc::OnStartTimer()
{
SetTimer(1,10000, 0);
}
void CAbc::OnTimer(UINT_PTR nIDEvent)
{
FolderCopy();
CDialog::OnTimer(nIDEvent);
}
void CAbc::FolderCopy()
{
CString finalString;
for(int aq=0;aq<20;aq++)
{
finalString=a1[aq];
char * szMyString = (char *)(LPCTSTR)finalString;
PathRemoveFileSpec(szMyString);
CString string = _T(szMyString);
CString string1=string;
string1 +='\0';
int nLen = string1.GetLength();
LPCSTR lpszBuf = string1.GetBuffer(nLen);
string1.ReleaseBuffer();
LPCSTR pF=lpszBuf;
LPCSTR pT="c:\\Testing";
SHFILEOPSTRUCT sf;
memset(&sf,0,sizeof(sf));
sf.hwnd = 0;
sf.wFunc = FO_COPY;
sf.pFrom = pF;
sf.pTo = pT;
sf.fFlags = FOF_NOCONFIRMATION | FOF_NOCONFIRMMKDIR | FOF_NOERRORUI;
int n = SHFileOperation(&sf);
if( n == 0)
{
AfxMessageBox("Success\n");
}
else
{
AfxMessageBox("Failed\n");
}
}
}
Plz help me
|
|
|
|
|
The Ontimer function will still be called in the same thread, if the FolderCopy function is a lenghty operation, your GUI will freeze because it is not able to process messages anymore. You should use a worker thread for that task. Take a look at this great article[^].
|
|
|
|
|
Thank for reply.it's a good artical.Can you give me tips,hoe i use thread for do that task.
Thanks in advance..
|
|
|
|
|
What do you mean ? Where are you stuck exactly ?
|
|
|
|
|
I havn't idea about Thread.So i want to what steps i use.Your artical is good. Plz help me
|
|
|
|
|
Having looked at your previous posts I think you should get familiar with some C/C++ basics before you start with multi-threaded programming.
|
|
|
|
|
Thanks for suggestion.Can you give me tips for do that task?
|
|
|
|
|
I think this site is a good starting point (frequently recommended by Hamid):
http://www.cplusplus.com[^]
You should also consider getting some books.
|
|
|
|
|
What a mess. Are you trying to copy the folders every 10 seconds?
|
|
|
|
|
I agree with Michael Schubert: what you are doing is, at least, very strange.
But if you are sure you do need to periodically copy your folder(s), then call KillTimer before calling FolderCopy and then reset the timer ( call SetTimer) after FolderCopy returns.
|
|
|
|
|
Try:
void CAbc::FolderCopy()
{
if (! m_bBusy)
{
m_bBusy = true;
for (...)
{
}
m_bBusy = false;
}
}
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hi All
After read artical i am useing this code.Can any one tell me i am wrong or right.
void CTestingDemoDlg::OnBnClickedButton1()
{
running = TRUE;
AfxBeginThread(sun, this);
AfxBeginThread(sun1, this);
}
void CTestingDemoDlg::sun()
{
OnStartTimer();
}
void CTestingDemoDlg::sun1()
{
AfxMessageBox(_T("Hello"));
}
UINT CTestingDemoDlg::sun(LPVOID p)
{
CTestingDemoDlg * me = (CTestingDemoDlg *)p;
me->sun();
return 0;
}
void CTestingDemoDlg::OnStop()
{
running = FALSE;
}
UINT CTestingDemoDlg::sun1(LPVOID p)
{
CTestingDemoDlg * me = (CTestingDemoDlg *)p;
me->sun1();
return 0;
}
void CTestingDemoDlg::OnTimer(UINT_PTR nIDEvent)
{
m_test.SetWindowTextW(_T("Sun"));
CDialog::OnTimer(nIDEvent);
}
void CTestingDemoDlg::OnStartTimer()
{
SetTimer(1, 5000, 0);
}
Plz help me
|
|
|
|
|
MsmVc wrote: Can any one tell me i am wrong or right.
What's wrong or right is ultimately up to you (since you are the only one that knows if your code produces the desired result). That said, what is your code (not) doing?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Thanks for help.It's working
|
|
|
|
|
Hi all,
PLease tell me how can i get Total days of a Year.(wheter 365 or 366)
thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
If the year is a multiple of 4, it's a leap year, i.e. there are 366 days.
Exception #1:
If the year is dividable by 100 it's not a leap year.
Exception #2:
If the year is dividable by 400 it's a leap year anyway.
Hint: use the modulus operator.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Thanks
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|