Click here to Skip to main content
16,007,885 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Best way to set min size for a window? Pin
Ian Bowler22-Nov-05 10:57
Ian Bowler22-Nov-05 10:57 
QuestionSerialization and File | Save Pin
BuckBrown22-Nov-05 7:49
BuckBrown22-Nov-05 7:49 
AnswerRe: Serialization and File | Save Pin
David Crow22-Nov-05 7:53
David Crow22-Nov-05 7:53 
GeneralRe: Serialization and File | Save Pin
BlackDice23-Nov-05 11:20
BlackDice23-Nov-05 11:20 
GeneralRe: Serialization and File | Save Pin
David Crow25-Nov-05 14:03
David Crow25-Nov-05 14:03 
AnswerRe: Serialization and File | Save Pin
Cliff Hatch24-Nov-05 23:39
Cliff Hatch24-Nov-05 23:39 
QuestionWeb page segmentation Pin
llp00na22-Nov-05 7:20
llp00na22-Nov-05 7:20 
QuestionSHFileOperation problem Pin
Alex Orovetskiy22-Nov-05 6:05
Alex Orovetskiy22-Nov-05 6:05 
I've got a serious problem with SHFileOperation which, in short, disallow me to use it for copying files (I haven't tried it on deleting\moving\something else). The code below is showing the way I am using it.
<br />
CString szTo(theApp.m_szMwDir), szFrom(theApp.m_szOoTDir);<br />
szTo += "\\Data Files\\\0\0";<br />
szFrom += "\\*.*\0";<br />
SHFILEOPSTRUCT fos;<br />
fos.hwnd = m_hWnd;<br />
fos.pFrom = szFrom;<br />
fos.pTo = szTo;<br />
fos.wFunc = FO_COPY;<br />
fos.fFlags = FOF_NOCONFIRMMKDIR;<br />
fos.hNameMappings = NULL;<br />
fos.lpszProgressTitle = NULL;<br />
SHFileOperation(&fos);


The problem is that when I run the application it comes out with "Error, file not found" error generated by SHFileOperation. theApp.m_szOoTDir is initialized correctly so it can't be a problem. Now let's get to the strange part. Let's assume that theApp.m_szOoTDir = "C:\TR_OoT_Test\Data Files" (it has this value in my test app so I'll use it for convenience). I want to copy all files in it and its subdirs to the destination directory (around 1000 in total) hence the wildcards. So, as I've already told, the application comes out with an error that the file cannot be found. But if I will create a char array and hardcode the path into application...it works. The path is the same:
CString szTo(theApp.m_szMwDir);<br />
szTo += "\\Data Files\\\0\0";<br />
char szFrom[] = "C:\\TR_OoT_Test\\Data Files\\*.*\0\0";<br />
SHFILEOPSTRUCT fos;<br />
fos.hwnd = m_hWnd;<br />
fos.pFrom = szFrom;<br />
fos.pTo = szTo;<br />
fos.wFunc = FO_COPY;<br />
fos.fFlags = FOF_NOCONFIRMMKDIR;<br />
fos.hNameMappings = NULL;<br />
fos.lpszProgressTitle = NULL;<br />
SHFileOperation(&fos);


If I will dynamically create char array by copying, concatenating, converting from CString or any other ways it stops working. So in short it works only with path written down when I am initializing an array or pointer to char string and ONLY to char string. I am absolutly clueless why it is so and how to overcome it. I was trying different workarounds for a few days and came up with nothing. In short - I am desperate. Any input is really appreciated.

Thank you for you time.
AnswerRe: SHFileOperation problem Pin
Chris Losinger22-Nov-05 6:32
professionalChris Losinger22-Nov-05 6:32 
AnswerRe: SHFileOperation problem Pin
David Crow22-Nov-05 8:09
David Crow22-Nov-05 8:09 
GeneralRe: SHFileOperation problem Pin
Alex Orovetskiy22-Nov-05 8:23
Alex Orovetskiy22-Nov-05 8:23 
GeneralRe: SHFileOperation problem Pin
Chris Losinger22-Nov-05 8:33
professionalChris Losinger22-Nov-05 8:33 
GeneralRe: SHFileOperation problem Pin
Alex Orovetskiy22-Nov-05 9:03
Alex Orovetskiy22-Nov-05 9:03 
GeneralRe: SHFileOperation problem Pin
David Crow22-Nov-05 9:00
David Crow22-Nov-05 9:00 
GeneralRe: SHFileOperation problem Pin
Alex Orovetskiy22-Nov-05 9:14
Alex Orovetskiy22-Nov-05 9:14 
GeneralRe: SHFileOperation problem Pin
Chris Losinger22-Nov-05 9:27
professionalChris Losinger22-Nov-05 9:27 
GeneralRe: SHFileOperation problem Pin
Alex Orovetskiy22-Nov-05 9:43
Alex Orovetskiy22-Nov-05 9:43 
GeneralRe: SHFileOperation problem Pin
Chris Losinger22-Nov-05 9:51
professionalChris Losinger22-Nov-05 9:51 
QuestionRe: SHFileOperation problem Pin
David Crow22-Nov-05 9:38
David Crow22-Nov-05 9:38 
AnswerRe: SHFileOperation problem Pin
Alex Orovetskiy22-Nov-05 9:48
Alex Orovetskiy22-Nov-05 9:48 
Questionwince - ppc2003 - change network management defaults Pin
sdt2422-Nov-05 5:40
sdt2422-Nov-05 5:40 
QuestionHandle to Menu Pin
NYTSX22-Nov-05 4:45
NYTSX22-Nov-05 4:45 
QuestionRe: Handle to Menu Pin
David Crow22-Nov-05 8:04
David Crow22-Nov-05 8:04 
AnswerRe: Handle to Menu Pin
PJ Arends22-Nov-05 8:06
professionalPJ Arends22-Nov-05 8:06 
GeneralRe: Handle to Menu Pin
NYTSX28-Nov-05 7:01
NYTSX28-Nov-05 7:01 

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.