在PB程序设计中,可以用Run()来运行一些程序。比如用户按了F1,就运行一个chm文件。但Run程序无法 与PB主程序协调工作,若用户按了多次F1,就会启动Run程序的多个实例,主程序退出时,Run程序依然 运行。可以用如下函数来使它们协调工作: Function Ulong FindWindowA(Ulong classname, String windowname) Library ″user32.dll″ Function Long SetParent(Long childwin,Long parentwin) Library ″user32.dll″ ⑴使Run程序只运行一个实例 handle=FindWindowA(nul,wtitle) //查找Run程序是否已经运行,wtitle为Run程序的标题 IF handle〉0 Then Return //若已经在运行就返回 Run(″C:\Program Files\Joint\Joint.chm″) //否则运行Run程序 ⑵PB主程序退出时,Run程序也关闭 handle=FindWindowA(nul,wtitle) SetParent(handle,Handle(w-main)) //使Run程序窗口成为PB主程序的子窗口 |
03-08
1122
