Click here to Skip to main content
15,912,082 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralChecking 'mute' of Speaker Pin
Shibu.V.Nair9-Jul-02 18:31
Shibu.V.Nair9-Jul-02 18:31 
Generalhelp me help me Pleaseee>>>>>>>> Pin
Anonymous9-Jul-02 18:25
Anonymous9-Jul-02 18:25 
GeneralRe: help me help me Pleaseee>>>>>>>> Pin
Christian Graus9-Jul-02 19:41
protectorChristian Graus9-Jul-02 19:41 
Generalcreating an image "transition" in gdi+ Pin
el_robert9-Jul-02 17:51
el_robert9-Jul-02 17:51 
Generalfor loop was cut off in first post Pin
el_robert9-Jul-02 17:53
el_robert9-Jul-02 17:53 
QuestionHow can ISAPI_Filter call the functions of Soap_Server? Pin
ansoe9-Jul-02 17:19
ansoe9-Jul-02 17:19 
QuestionHow much memory is used? Pin
Antosha9-Jul-02 17:17
Antosha9-Jul-02 17:17 
GeneralUsing SHFileOperation. Pin
David Fleming9-Jul-02 16:58
David Fleming9-Jul-02 16:58 
I keep getting an error message telling me that the file cannot be found UNLESS I hard-code the name of the file to work on (in this case delete).

Here's the code:
SHFILEOPSTRUCT fileOp;
CString sSrc; //this is actually declared and set earlier
fileOp.hwnd = this->m_hWnd;
sSrc = pItem->sCol4; //pointer to a STRUCT containing CStrings
fileOp.pFrom = (LPCSTR)sSrc; //Source path+name
fileOp.pTo = "\0"; //Unhandled exception if I don't set this
fileOp.fFlags = FOF_NOCONFIRMATION | FOF_SILENT;
fileOp.wFunc = FO_DELETE;
int iRes = SHFileOperation(&fileOp);


It seems apparent that the problem is in the conversion from the CString to LPCSTR for fileOp.pFrom. It works fine if I replace the line "fileOp.pFrom...." with
fileOp.pFrom = "C:\\Dummy.txt";


The strings look correct in the debugger window, so I'm at a loss here.

I've tried various different castings and even tried using sSrc.GetBuffer(n) where n is various different values. None of those things seems to make a difference.

So what's the snag? Any suggestions?
GeneralRe: Using SHFileOperation. Pin
Michael Dunn9-Jul-02 19:23
sitebuilderMichael Dunn9-Jul-02 19:23 
GeneralRe: Using SHFileOperation. Pin
David Fleming10-Jul-02 6:59
David Fleming10-Jul-02 6:59 
GeneralRe: Using SHFileOperation. Pin
Michael Dunn11-Jul-02 16:07
sitebuilderMichael Dunn11-Jul-02 16:07 
GeneralRe: Using SHFileOperation. Pin
David Fleming11-Jul-02 21:32
David Fleming11-Jul-02 21:32 
GeneralExpression to Binary Tree Pin
Anonymous9-Jul-02 16:34
Anonymous9-Jul-02 16:34 
GeneralRe: Expression to Binary Tree Pin
Rage9-Jul-02 23:04
professionalRage9-Jul-02 23:04 
GeneralRe: Expression to Binary Tree Pin
Anonymous10-Jul-02 4:28
Anonymous10-Jul-02 4:28 
GeneralRe: Expression to Binary Tree Pin
Rage10-Jul-02 5:13
professionalRage10-Jul-02 5:13 
GeneralRe: Expression to Binary Tree Pin
Chris Losinger10-Jul-02 5:23
professionalChris Losinger10-Jul-02 5:23 
QuestionHow to Update Dialog Box Pin
Solero9-Jul-02 16:29
Solero9-Jul-02 16:29 
AnswerRe: How to Update Dialog Box Pin
Christian Graus9-Jul-02 17:48
protectorChristian Graus9-Jul-02 17:48 
GeneralRe: How to Update Dialog Box Pin
Rage9-Jul-02 23:07
professionalRage9-Jul-02 23:07 
GeneralSave Data Problem Pin
chen9-Jul-02 15:33
chen9-Jul-02 15:33 
GeneralSerialize function stops working all of a sudden Pin
Comfortably Numb9-Jul-02 12:54
Comfortably Numb9-Jul-02 12:54 
GeneralRe: Serialize function stops working all of a sudden Pin
Joaquín M López Muñoz9-Jul-02 13:10
Joaquín M López Muñoz9-Jul-02 13:10 
QuestionHow to use this Code? Pin
NickOne9-Jul-02 10:58
NickOne9-Jul-02 10:58 
GeneralHelp on WMF/EMF to file Pin
Jim Crafton9-Jul-02 10:26
Jim Crafton9-Jul-02 10:26 

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.