我现在要求不管调用几次我的程序,只启动一个实例。第一次启动时,传递的参数是正确的,可是第二次以后就不传递参数了。请问这是怎么回事?

解决方案 »

  1.   

    我的在工程文件里一部分代码如下:
    begin  hMutex:=CreateMutex(nil,false,'hkOneCopy');
      if  WaitForSingleObject(hMutex,0)<>wait_TimeOut then
      begin    if ParamCount>0 then
        begin
          Start_Mode:=Intranet;
          ParamString:=ParamStr(1);
        end
        else
          Start_Mode:=Internet;    Application.Initialize;
        Application.CreateForm(TBrowserForm, BrowserForm);
           ....
        Application.Run;
      end
      else
      begin
        if ParamCount>0 then
        begin
          Start_Mode:=Intranet;
          ParamString:=ParamStr(1);
        end;
     
        SetLength(MoudleName,100);
        GetModuleFileName(HInstance,pchar(MoudleName),length(MoudleName));
        
        MoudleName:=pchar(MoudleName);
        EnumWindows(@EnumWndProc,0);//调用枚举函数
        if FindHid<>0 then
          SetForegroundWindow(FindHid);
      end;
    end.
    高手请帮忙指点,万分感激。
      

  2.   

    to sixgj(轰炸机):
     麻烦你指点一下。详细说明。谢谢。