1、检测操作系统版本 prototype CheckOSVersion(); //当前操作系统版本(针对9X) //返回TRUE,FALSE(低于win98第二版) function CheckOSVersion() STRING svResult; NUMBER nOSVersion, nvOS; begin if (GetSystemInfo ( OS , nvOS , svResult )!= 0) then return FALSE; endif; if nvOS == IS_WINDOWS9X then GetSystemInfo ( OSMAJOR , nOSVersion , svResult ); if nOSVersion < 10 then return FALSE; endif; endif; return TRUE; end; 2、检测程序是否运行,并且关闭 prototype CheckProgramRun(STRING); //检查程序是否在运行 //返回0没有运行,1正在运行 function CheckProgramRun(szProgName) INT nRet; HWND nHwnd; begin if (szProgName == "") then nRet = 0; return nRet; endif; //得到句柄 nHwnd = FindWindow("", szProgName); if nHwnd != NULL then nRet = 1; /发消息关闭程序 SendMessage (nHwnd, WM_SYSCOMMAND, SC_CLOSE, 0); else nRet = 0; endif; return nRet; end;
|