المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Enigma with ShellExecute ? [modified]



C++ Programming
10-05-2009, 11:30 PM
Hi there,

I got the strangest problem. I want to start an executable with ShellExecute(). Which usually works fine, but ...

(this is the code)



char buf[512]
size = GetCurrentDirectoryA( 512, buf ); // get absolute path


// version 1
char callString[1024];
sprintf_s( callString, "%s\\%s", buf, file.c_str() );
// version 2
char buf[1024];
sprintf_s( buf, "c:\\Users\\zwatschek\\work\\svn\\incubation\\ttsServer\\Data\\ttsWatchdog.exe" );

char id[32];
sprintf_s( id, "%d", pid );

long res=long(ShellExecute(0, "open", callString, id, 0, SW_SHOWNORMAL));


... with version 2 things work fine, with version 1 I get ERROR_FILE_NOT_FOUND.

callString = c:\Users\zwatschek\work\svn\incubation\ttsServer\Data\ttsWatchdog.exe
buf = c:\Users\zwatschek\work\svn\incubation\ttsServer\Data\ttsWatchdog.exe

(I copied those strings right out from the variable watch)

Does anyone have an idea on this?

Souldrift

modified on Monday, October 5, 2009 5:00 AM