开发者

what is the problem with my path inside CString?

开发者 https://www.devze.com 2023-03-19 02:05 出处:网络
Why this c开发者_开发问答ode does not work? :( CString parameterA = _T(\"c:\\Program Files\\test\\identify.exe\");

Why this c开发者_开发问答ode does not work? :(

  CString parameterA = _T("c:\Program Files\test\identify.exe");  
  CString parameterB = _T(" -format \"%w\" ") + pictureName;

  if (CreateProcess(parameterA.GetBuffer(), parameterB.GetBuffer(),0,0,TRUE,
          NORMAL_PRIORITY_CLASS|CREATE_NO_WINDOW,0,0,&sInfo,&pInfo))
          {
            WaitForSingleObject (pInfo.hProcess, INFINITE);
          }

But, when I change the....

CString parameterA = _T("c:\Program Files\test\identify.exe"); 

to..

CString parameterA = _T("identify.exe"); 

it just works.

Help me..


It's the slashes.

CString parameterA = _T("c:\Program Files\test\identify.exe"); 

Note that you have the escape sequences \P, \t and \i, only one of which actually means something (\t is a tab character, and is not what you really want!).

Instead, escape the slashes so they get interpreted as slashes:

CString parameterA = _T("c:\\Program Files\\test\\identify.exe"); 
0

精彩评论

暂无评论...
验证码 换一张
取 消