我需要用ShellExecute执行一个bat文件,该bat文件内容如下:@echo offsetlocal
set CURRENT_DIR=%~dp0%cd %CURRENT_DIR%\Opus\"d:\MyApp\MyApp.exe" -cd -regfile .\Registry\Default_Styling.reg -javaopt "-f .\copycopy6.osf"endlocal 该如何向ShellExecute传参数呢?即该如何写ShellExecute的第四个参数LPCTSTR lpParameters呢?

解决方案 »

  1.   

    ::sendmessage(,WM_COPYDATA,)
    copydata 可以传字符串
      

  2.   

    SHELLEXECUTEINFO ShExecInfo = {0};
    ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
    ShExecInfo.fMask = SEE_MASK_NO_CONSOLE;
    ShExecInfo.hwnd = NULL;
    ShExecInfo.lpVerb = NULL;
    ShExecInfo.lpFile = "c:\\receiver.exe";//你要打开的文件
    ShExecInfo.lpParameters = "";
    ShExecInfo.lpDirectory = NULL;
    ShExecInfo.nShow = SW_SHOW;
    ShExecInfo.hInstApp = NULL;
    ShellExecuteEx(&ShExecInfo);
    然后用
    HWND hWnd = ::FindWindow(NULL,"Receiver");::sendmessage(hWnd,wm_copydata       .......
    后边的自己写哈