h:hwnd; h:=findwindow('你主窗口的标题',nil); if h<>null then application.terminate; application.createform(……………………) ………………………………………………………… application.run;编译时把主窗口关了! 互斥对象也可以!
建立一个互斥内核对象就行了 在应用程序开始时,如下方法: var hnd:Handle; hnd := CreateMutex(nil, True, '{631BCE72-D32A-42B9-9F70-FAB5106F5630}'); if GetLastError = ERROR_ALREADY_EXISTS then Halt;
h:=findwindow('你主窗口的标题',nil);
if h<>null then application.terminate;
application.createform(……………………)
…………………………………………………………
application.run;编译时把主窗口关了!
互斥对象也可以!
在应用程序开始时,如下方法:
var hnd:Handle;
hnd := CreateMutex(nil, True, '{631BCE72-D32A-42B9-9F70-FAB5106F5630}');
if GetLastError = ERROR_ALREADY_EXISTS then Halt;