随笔分类 - Delphi
摘要:关于禁止程序重复启动的另一种需要与实现手头的程序需要禁止重复启动, 但需要保留新的、关闭旧的.我想还是从主窗口的类名下手吧; 写了一个函数, 在 OnCreate 中调用即可:{ 函数 }procedure CloseSameClassNameWindow(ACurrentWindow: HWND; const AClassName: string);var h: HWND; buf: array[0..255] of Char;begin h := ACurrentWindow; while h > 0 do begin h := GetWindow(h, GW_HWNDNEXT);
阅读全文