|
#DEFINE SEMAPHORE_ALL_ACCESS 2031619 DECLARE INTEGER OpenSemaphore IN WIN32API INTEGER, INTEGER, STRING DECLARE INTEGER CloseHandle IN WIN32API INTEGER DECLARE INTEGER WaitForSingleObject IN WIN32API INTEGER, INTEGER DECLARE INTEGER ReleaseSemaphore IN WIN32API INTEGER, INTEGER, INTEGER DECLARE INTEGER GetLastError IN WIN32API LOCAL count, FW_S1, RetVal, TotalChannels, channels, TimeExtension, ChannelStatus
CLEAR TotalChannels = VAL(RegGet('TotalChannels')) FOR count = 1 TO TotalChannels M.FW_S1 = OpenSemaphore(SEMAPHORE_ALL_ACCESS, 0, 'S1FW'+LTRIM(STR(M.Count))) IF M.FW_S1 = 0 M.FW_S1 = OpenSemaphore(SEMAPHORE_ALL_ACCESS, 0, 'Global\S1FW'+LTRIM(STR(M.Count))) ENDIF IF M.FW_S1 != 0 RetVal = WaitForSingleObject(M.FW_S1, 0) IF M.RetVal = 0 ReleaseSemaphore(M.FW_S1, 1, 0) ChannelStatus = "Ready" ELSE ChannelStatus = "Busy" ENDIF CloseHandle(M.FW_S1) ELSE ChannelStatus = "Unreachable" ENDIF ? "Channel " + LTRIM(STR(M.Count)) + ": " + ChannelStatus NEXT RETURN
FUNCTION regget PARAMETERS Name, key, CurrentUser
********************************************* #DEFINE REG_PATH 'SOFTWARE\Aegis Group\FoxWeb\CurrentVersion' #DEFINE HKEY_CURRENT_USER 0x80000001 #DEFINE HKEY_LOCAL_MACHINE 0x80000002 * -- Key Data Types #DEFINE REG_SZ 1 && string #DEFINE REG_EXPAND_SZ 2 #DEFINE REG_BINARY 3 && binary #DEFINE REG_DWORD 4 && 32-bit number
*Windows API declarations DECLARE Integer RegOpenKey IN Win32API Integer, String@, Integer@ DECLARE Integer RegCloseKey IN Win32API Integer nHKey DECLARE Integer RegQueryValueEx IN Win32API Integer, String, ; Integer, Integer@, String@, Integer@
PRIVATE KeyHandle, Data, DataLen, path IF PARAMETERS() > 1 .AND. TYPE('M.key') = 'C' IF LEFT(M.key,1) = '\' M.Path = SUBSTR(M.key,2) ELSE M.Path = REG_PATH+'\'+M.key ENDIF ELSE M.Path = REG_PATH ENDIF KeyHandle=0 Data = SPACE(256) DataLen = LEN(M.Data) Type = 0 IF M.CurrentUser = RegOpenKey(HKEY_CURRENT_USER, M.Path, @M.KeyHandle) ELSE = RegOpenKey(HKEY_LOCAL_MACHINE, M.Path, @M.KeyHandle) ENDIF = RegQueryValueEx(M.KeyHandle, M.Name, 0, @M.type, @M.Data, @M.DataLen) = RegCloseKey(M.KeyHandle)
IF M.DataLen < AT(CHR(0), M.Data)-1 RETURN LEFT(M.Data, M.DataLen) ELSE RETURN LEFT(M.Data, AT(CHR(0), M.Data)-1) ENDIF ENDFUNC |
FoxWeb Support Team support@foxweb.com email |