Click here to Skip to main content
15,926,596 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CImageList and CBitmap Pin
JamesLaing17-Feb-03 12:18
JamesLaing17-Feb-03 12:18 
QuestionAccessing a CTypedPtrArray obj. from a child dialog? Pin
Miguel Lopes17-Feb-03 7:48
Miguel Lopes17-Feb-03 7:48 
AnswerRe: Accessing a CTypedPtrArray obj. from a child dialog? Pin
Joaquín M López Muñoz17-Feb-03 10:08
Joaquín M López Muñoz17-Feb-03 10:08 
GeneralRe: Accessing a CTypedPtrArray obj. from a child dialog? Pin
Miguel Lopes17-Feb-03 11:57
Miguel Lopes17-Feb-03 11:57 
GeneralRe: Accessing a CTypedPtrArray obj. from a child dialog? Pin
Miguel Lopes20-Feb-03 13:17
Miguel Lopes20-Feb-03 13:17 
GeneralCreateDirectory function Pin
luc_favaro17-Feb-03 7:43
luc_favaro17-Feb-03 7:43 
GeneralRe: CreateDirectory function Pin
Nish Nishant17-Feb-03 7:55
sitebuilderNish Nishant17-Feb-03 7:55 
GeneralRe: CreateDirectory function Pin
luc_favaro17-Feb-03 8:18
luc_favaro17-Feb-03 8:18 
This is the routine that i got a problem, it basiclly copy all files located in sPath to dPath.

The function CreateDirectory and CopyFile ar not running on windows98. I generated a log file and i discovered that on windows 98 the string dPath became invalid like:

original: "c:\teste"

garbage: "Y:\teste"

I read some articles and some of them indicate that the problem is Unicode conversion, but i try to follow the articles steps but it´s unusably.

One thing,

if in the function call CreateDirectory((LPCTSTR)dPath,NULL);
i change (LPCTSTR)dPath by a constant like "c:\\teste" the function run.

Please if you could help me, i´m thank,

LFávaro.


BOOL Cteste11Dlg::CreateTree(CString &sPath, CString &dPath)
{



CreateDirectory((LPCTSTR)dPath,NULL);

fstream f;

try
{

f.open("c:\\arq_log", ios::app);
// log para debug
// dt = _datetime_t::now();
//f << dt.fmt() << "DEBUG - Abriu arquivo de log\n";

}
catch (CFileException * pEx)
{

// log para debug
// dt = _datetime_t::now();
// f << dt.fmt() << "DEBUG - Ocorreu erro ao abrir arquivo\n";

TCHAR sz[1024];
pEx->GetErrorMessage(sz, 1024);

// log - erro gerado por excecao
// dt = _datetime_t::now();
//f << dt.fmt() << ERRO << sz;

pEx->Delete();
return FALSE;
}
f << "|" << (LPCTSTR)dPath << "|\n";

f.close();

CFileFind finder;
CString sWildCard = sPath + "\\*.*";

//CString sDestFile;
CFileFind finderDestFile;

BOOL bFound;

BOOL bWorking = finder.FindFile(sWildCard);

bFound = bWorking;
while (bWorking)
{
bWorking = finder.FindNextFile();


if (finder.IsDots())
continue;
if (finder.IsDirectory())
{
CString s = finder.GetFilePath();
CString temp=dPath+"\\"+finder.GetFileName()+"\\";
BSTR bstr2 = temp.AllocSysString();
BOOL a=CreateDirectoryW(bstr2,NULL);
DWORD d=GetLastError();
CreateTree(s,temp);
continue;
}

// copy files
if (CopyFile(finder.GetFilePath(),(dPath+"\\"+finder.GetFileName()), FALSE))
{

DWORD dwAttrs = GetFileAttributes(finder.GetFilePath());
if (!(dwAttrs & FILE_ATTRIBUTE_READONLY))
{
SetFileAttributes((dPath+"\\"+finder.GetFileName()),
dwAttrs | FILE_ATTRIBUTE_READONLY);
}
}
/*else
{
DWORD l=GetLastError();
MessageBox("Couldn't copy file.");
} */

}
return bFound;


}

LFávaro
GeneralRe: CreateDirectory function Pin
Nish Nishant17-Feb-03 9:58
sitebuilderNish Nishant17-Feb-03 9:58 
GeneralActiveX Control on website.. (again) Pin
Ice|Man17-Feb-03 7:35
Ice|Man17-Feb-03 7:35 
GeneralRe: ActiveX Control on website.. (again) Pin
OBRon17-Feb-03 9:23
OBRon17-Feb-03 9:23 
GeneralRe: ActiveX Control on website.. (again) Pin
Ice|Man17-Feb-03 9:53
Ice|Man17-Feb-03 9:53 
GeneralRe: ActiveX Control on website.. (again) Pin
OBRon17-Feb-03 10:59
OBRon17-Feb-03 10:59 
QuestionHow can I learn HOOK? Pin
Anonymous17-Feb-03 7:34
Anonymous17-Feb-03 7:34 
AnswerRe: How can I learn HOOK? Pin
Nish Nishant17-Feb-03 7:56
sitebuilderNish Nishant17-Feb-03 7:56 
GeneralPDF CView (still needed...) Pin
Archigal17-Feb-03 5:00
Archigal17-Feb-03 5:00 
GeneralRe: PDF CView (still needed...) Pin
jhwurmbach17-Feb-03 5:16
jhwurmbach17-Feb-03 5:16 
GeneralGateway IP under Win NT Pin
Koep17-Feb-03 4:49
Koep17-Feb-03 4:49 
GeneralKazaa Search Automation Pin
lumpyandsuspicious17-Feb-03 4:35
lumpyandsuspicious17-Feb-03 4:35 
GeneralRe: Kazaa Search Automation Pin
Joan M17-Feb-03 5:12
professionalJoan M17-Feb-03 5:12 
GeneralRe: Kazaa Search Automation Pin
User 665817-Feb-03 8:01
User 665817-Feb-03 8:01 
QuestionFile sorting NT vs. 2000 ? Pin
will138317-Feb-03 4:26
will138317-Feb-03 4:26 
AnswerRe: File sorting NT vs. 2000 ? Pin
peterchen17-Feb-03 5:20
peterchen17-Feb-03 5:20 
AnswerRe: File sorting NT vs. 2000 ? Pin
Scott H. Settlemier17-Feb-03 6:23
Scott H. Settlemier17-Feb-03 6:23 
AnswerRe: File sorting NT vs. 2000 ? Pin
Mike Nordell17-Feb-03 17:47
Mike Nordell17-Feb-03 17:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.