我现在有一个程序,需要外界给我一个参数,然后程序根据这个参数来选择不同的运行方式。我用的是VC编写的这个程序!!这个调用的方式,采用的是快捷方式的形式,请问怎么样来通过快捷方式把这个参数传进来??很感激不尽,对各位朋友的回答!!!

解决方案 »

  1.   

    你可以在快捷方式中的"目标(T):"中去写你的参数啊如下
    "D:\Microsoft Visual Studio\Common\MSDev98\Bin\MSDEV.EXE" readme.txt
    就是vc读取与快捷方式同目录的文件readme.txt
      

  2.   

    这个调用的程序,我是放在InstallShield中调用的,也就是通过在InstallShield中建立快捷方式,来启动该程序,但是需要传递参数,这个参数如何传递进来,我在VC的程序又如何接受这个参数??谢谢了!!
      

  3.   

    InstallShield中调用应该很easy啊。下面是一个例子:
    /*--------------------------------------------------------------*\  * * InstallShield Example Script * * Demonstrates the LaunchApp function. * * LaunchApp is called to execute an application. * * Note: Before running this script, set the preprocessor *       constants so that they reference the fully-qualified *       names of the Windows Notepad executable and a valid  *       text file on the target system. *\*--------------------------------------------------------------*/#define APPLICATION WINDIR^"Notepad.exe"#define CMD_LINE    WINDIR^"Readme.txt"#include "ifx.h"program   // Launch the Windows Notepad application to edit   // the Windows Readme.txt file.   if (LaunchApp (APPLICATION, CMD_LINE) < 0) then      MessageBox ("Unable to launch "+APPLICATION+".", SEVERE);   endif;endprogram
      

  4.   

    那你就多做几个版本,在不同的情况下调用不同的程序!
    在你启动之前用HOOK,
      

  5.   

    WinMain(中的参数中就有一个LPSTR lpCmdLine)嘛,这个可以传进来。在快捷方式中后面加一个空格与%1
      

  6.   

    大家可能还不清楚我的意思,我是说,我要通过Installshield来建立一个程序的快捷方式,然而调用的是一个VC写的应用程序,但是这个应用程序,要根据当前的安装程序的一个参数来执行我的应用程序的不同部分,现在是这个参数如何传进,在VC中又如何得到??谢了!!