The Programming Thing..Please Help..
Ok..today is Friday..I did mention in the previous post that this day is the best day for me..but h3ck, today I am having a lil not-so-lil problem..It's the programming thing!! and I dont want this to ruin my mood, as for me, if Friday is messed up, the whole weekend would be affected too! So I need your help guys..

I bet you guys might be thinking that a life as a programmer is good sucks..I do agree for some reason..In fact most of my friends do feel sorry for me because I am a programmer (h3ll, this is true, really!)..They believe I have to work hard to get any assignments done..

Owh ok..where were we? yer, programming problem..If you guys have any experience in C++ please take a look at the part of the project codes below which I havent found the errors in it..

If you guys are advanced C++ programmers, please focus on the bordered lines, that's where errors occur. Else, you have to understand line by line..

The codes (sorry, quite long):


while (nIndex != -1)
{
CString strLocalName;
if (bShowFileDialog)
{
CFileDialog dlg(FALSE, strFile, strFile, OFN_NOVALIDATE | OFN_HIDEREADONLY, "All Files (*.*)|*.*||", this);

dlg.m_ofn.lpstrTitle = "Download to";

if (dlg.DoModal() == IDOK)
{
strLocalName = dlg.GetPathName();
}
else
{
// canceled
return;
}
}
else
{
strLocalName = m_FtpSite.m_strLocalPath + "\\" + strFile;
}

int nResult = IDYES;
// A quick'n'easy way to see if a file or directory exists.
DWORD dwAttributes = GetFileAttributes(strLocalName);
if ((dwAttributes != 0xFFFFFFFF) && !bYesToAll)
{
// is selected item a directory ?
if (GetFtpListView()->IsDirectory(nIndex))
{
CReplaceFolderDlg dlg;

dlg.m_nFileCount = nCount;
dlg.m_strFileName = strFile;
// show confirm dialog
nResult = dlg.DoModal();
}
else
{
CReplaceFileDlg dlg;

dlg.m_nFileCount = nCount;
dlg.m_strFileName = strFile;

WIN32_FILE_ATTRIBUTE_DATA fad;
// get local file attributes
if (GetFileAttributesEx(strLocalName, GetFileExInfoStandard, &fad))
{
CTime localLastWrite(fad.ftLastWriteTime);
dlg.m_strPropertiesOld.Format("%s\r\nmodified: %s", GetFtpListView()->FormatSize(fad.nFileSizeLow), localLastWrite.Format("%#c"));
}

// get remote file attributes
CFtpListView::ITEMINFO* pItem = (CFtpListView::ITEMINFO*)GetFtpListView()->GetListCtrl().GetItemData(nIndex);
CTime remoteLastWrite(pItem->ftLastWriteTime);
dlg.m_strPropertiesNew.Format("%s\r\nmodified: %s", GetFtpListView()->FormatSize(pItem->nFileSize), remoteLastWrite.Format("%#c"));

// show confirm dialog
nResult = dlg.DoModal();
}
//==========================================================
//the errors occur in these lines **bordered lines**
//==========================================================
//weekend activities
if (nDay == Saturday)
{
if (nTime == Morning) then
bFree = TRUE;
sleep(nHour, nWakeUpTime); //call function sleep
else if (nTime == Afternoon) then
bWakeUp = TRUE;
mood = happy + malas - work; //this variable will decide the next functions
sleep(nHour);
watchTV(nHour);
hangOut(nPlace, nHour);
else
//The function below will randomize which game to be played
Rnd (NFSMW, GTA SanAndreas, FIFA06);
playGames(nHour);
sleep(nHour);
}
else //(nDay == Sunday)..havent coded yet..
//==========================================================
//==========================================================
// check result code
if (nResult == IDYES)
{
}
else
if (nResult == IDYESTOALL)
{
bYesToAll = TRUE;
}
else
if (nResult == IDNO)
{
nIndex = GetFtpListView()->GetListCtrl().GetNextItem(nIndex, LVNI_ALL | LVNI_SELECTED);
continue;
}
else
{
// quit download
return;
}
}
// is selected item a directory ?
if (GetFtpListView()->IsDirectory(nIndex))
{
CString strCurrentDirectory = m_strCurrentDirectory;
strCurrentDirectory.TrimRight('/');
DownloadDirectory(strCurrentDirectory + "/" + strFile, strLocalName);
}
else
{
DWORD dwSize = GetFtpListView()->GetFileSize(nIndex);

CString strCurrentDirectory = m_strCurrentDirectory;
strCurrentDirectory.TrimRight('/');

DownloadFile(strCurrentDirectory + "/" + strFile, dwSize, strLocalName);
}
nIndex = GetFtpListView()->GetListCtrl().GetNextItem(nIndex, LVNI_ALL | LVNI_SELECTED);
}


I at the moment still havent found the errors..Please help!! Tomorrow is gonna be Saturday! I must complete it today..or I wont have a good weekend..isk..isk..
..
..
..
Another nothing-to-do-while-working crap..
0 comments:

Post a Comment
Get back to home


Profilo
Hotlinks
Divisions
Daily Doses
What's New
Posted B4
Booked
I Do Surf
Home | e-toyol.com | Latipah | Premier Goals