部一个简单的问题 ( 积分: 20 )

  • 主题发起人 主题发起人 xgbing
  • 开始时间 开始时间
X

xgbing

Unregistered / Unconfirmed
GUEST, unregistred user!
hMutex=CreateMutex(NULL,False,&quot;ss&quot;);<br> &nbsp; &nbsp; &nbsp; &nbsp;if(GetLastError()==ERROR_ALREADY_EXISTS)<br> &nbsp; &nbsp; &nbsp; &nbsp;{<br><br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;h=FindWindow(&quot;TForm1&quot;,&quot;ss&quot;);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ShowWindow(h,SW_SHOWNORMAL);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SetForegroundWindow(h);<br><br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br><br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return 0;<br><br> &nbsp; &nbsp; &nbsp; &nbsp;}<br><br><br>第二次运行程序,找到并显示了窗体,但点击最小化却不能最小化了!
 
hMutex=CreateMutex(NULL,False,&quot;ss&quot;);<br> &nbsp; &nbsp; &nbsp; &nbsp;if(GetLastError()==ERROR_ALREADY_EXISTS)<br> &nbsp; &nbsp; &nbsp; &nbsp;{<br><br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;h=FindWindow(&quot;TForm1&quot;,&quot;ss&quot;);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ShowWindow(h,SW_SHOWNORMAL);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SetForegroundWindow(h);<br><br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br><br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return 0;<br><br> &nbsp; &nbsp; &nbsp; &nbsp;}<br><br><br>第二次运行程序,找到并显示了窗体,但点击最小化却不能最小化了!
 
如果你这个窗体已经最小化了,则就是这么一个结局。<br>你应当判定窗体是否已经最小化,已经最小化,就不能call该参数,而是restore吧。到底是哪一个忘了,最大化也是同理
 
谢谢章慧<br>但我用RESTORE也是一样的
 
接受答案了.
 

Similar threads

I
回复
0
查看
511
import
I
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
后退
顶部