0

これを読んで、C# アプリケーションを開くことができました。私の C# アプリケーションはフォルダーを開き、グラフを描画します。C++ から開くフォルダーを C# アプリケーションに指示し、グラフが表示されて C# プログラムが閉じられると、C++ アプリに戻ることは可能ですか。

編集:マシューに感謝します。

私の CreateProcess lpCommandLine 変数に関連する別のクエリ: (以下はコードです)

CString sFolderPath = "C:\Documents and Settings\...";
      int nStrBuffer = sFolderPath.GetLength() + 50;
      LPTSTR szParam = _tcsdup(sFolderPath.GetBuffer(nStrBuffer));

  nRet = ::CreateProcess(szCmdline,// pointer to name of executable module 
  szParam,// pointer to command line string
  NULL,// pointer to process security attributes 
  NULL,// pointer to thread security attributes 
  FALSE,// handle inheritance flag 
  DETACHED_PROCESS,// creation flags 
  NULL,// pointer to new environment block 
  NULL,// pointer to current directory name 
  &sui,// pointer to STARTUPINFO 
  &pi );// pointer to PROCESS_INFORMATION

変数 szParam を適切に取得しましたが、アプリケーションが開いたときに完全なファイル名がコピーされません。例: 上記の場合、「C:\Documents」の部分が残されているため、「and Settings....」のみがコピーされます。私の間違いを指摘していただけますか?

C# 実装:

[STAThread]
static void Main(string[] args)
{
    foreach (string result in args)
    {
        MessageBox.Show(result);
    }
}
4

1 に答える 1