窗体F,按钮B,B的ONCLICK内容是 
   hide (隐藏f)窗体F1,有按钮B1,B1的ONCLICK的内容是
   showindow(...,sw_normal);(显示f)然后
依次点击
1:b,
2:b1,
3:b,
4:b1
结果是1,2步骤正常,3无法再隐藏,自然4也就没有什么意义。不知道什么原因!求教!

解决方案 »

  1.   

    将B1的事件改为F.Show;不用ShowWindow试下。
      

  2.   

    显示用下面语句试试:
    form2.Show;
      

  3.   


    这没有试过。主要是因为这是两个不同的exe,其中F一个程序,F1是另外一个程序,通过SHOWWINDOW更合适一些。
      

  4.   


    这没有试过。主要是因为这是两个不同的exe,其中F一个程序,F1是另外一个程序,通过SHOWWINDOW更合适一些。测试了下,的确不行,那只有在F程式中再加个按钮,这个按钮的功能是将自己Show出来;
    F1的B1去触发这个按钮的点击事件F中加个按钮C,C的代码如下:procedure TForm2.Button2Click(Sender: TObject);
    begin
      Self.Show;
    end;F1中B1的代码修改成如下:procedure TForm1.Button2Click(Sender: TObject);
    var
      H, MyPopup: THandle;
    begin
      H := StrToIntDef('$' + Edit1.Text,  0);//F中C的句柄
      SendMessage(H, BM_CLICK, 0, 0);
    end;
      

  5.   

    窗体F1中B1在Show窗体F之前,重新找一下句柄。
      

  6.   

    找了半天,找到可能答案
    http://msdn.microsoft.com/en-us/library/ms632598(v=vs.85).aspx#creating_main
    Controls how the window is to be shown. This parameter is ignored the first time an application calls ShowWindow, if the program that launched the application provides a STARTUPINFO structure. Otherwise, the first time ShowWindow is called, the value should be the value obtained by the WinMain function in its nCmdShow parameter. In subsequent calls, this parameter can be one of the following values. 进过实验,hide的时候,用showwindow(handlle,sw_hide)则不会出现那个问题。
      

  7.   

    隐藏不行就用关闭试试呗。
    这是.net吧,