2015-10-16 87 views
-1

我有一個按鈕,打開一個exe文件,我想要做的是檢查以確保此文件存在之前啓動EXE。我怎麼能做到這一點?任何幫助將不勝感激。如何檢查文件是否存在打開在EXE C++

我一點點生鏽我的C++,這是用C++ 6.0 和Windows XP ...

這裏是我的代碼遺留應用程序..

void CJunkView::OnCadkeyButton() 

    { 
    CString year = "Desktop"; 
    CString fileName = "x.prt"; 
    CString fileToOpen = "\"C:\\Documents and settings\\Administrator\\" + year +"\\" + fileName + "\""; 
    CString exePath = "\"C:\\CK19\\Ckwin.exe\""; 
    CString cmd = "start " + exePath + ", " + fileToOpen; 
    system (cmd.GetBuffer(cmd.GetLength() + 1)); 

    } 
+0

您是否執行過任何研究? –

+0

另請參閱:http://stackoverflow.com/q/12774207/560648 –

+0

https://msdn.microsoft.com/en-us/library/aa246685(v=vs.60).aspx – Lingxi

回答