;------------------------------------------------------------------------------------------------------------------------------------------ ; How to check if extender module can be loaded or is already loaded? ; ; (c)Detlev Dalitz.20110329. ; Based on proposal by Lars M. Doornbos.20110329. ;------------------------------------------------------------------------------------------------------------------------------------------ #DefineFunction udfExtenderExist (strFileExtender) arrExtenders = Arrayize (IntControl (77, 42, 0, 0, 0), @TAB) ; Get WB internal operating parameters. p1=42=tab-delimited list of extenders loaded. If ArrInfo (arrExtenders, 1) < 1 Then Return 0 If ArraySearch (arrExtenders, FileLocate (strFileExtender), 2) > -1 Then Return 1 If ArrInfo (arrExtenders, 1) > 9 Then Return 2 Return 0 #EndFunction ; Test. AddExtender ("wwads44i.dll") ; 1 AddExtender ("wwctl44i.dll") ; 2 AddExtender ("wwcpu44i.dll") ; 3 AddExtender ("wwhll44i.dll") ; 4 AddExtender ("wwfaf44i.dll") ; 5 AddExtender ("wwhug34i.dll") ; 6 AddExtender ("wwipg44i.dll") ; 7 AddExtender ("wwmap44i.dll") ; 8 AddExtender ("wwwnt34i.dll") ; 9 ;AddExtender("Wwpst44i.dll") ; 10 ; Un-/comment this entry. ;AddExtender("wsrch34i.dll") ; 10 ; Un-/comment this entry. ; We want to load the following extender module without knowing what modules have been loaded so far. strExtender = FileLocate ("wsrch34i.dll") Switch udfExtenderExist (strExtender) Case 0 Message ("0|udfExtenderExist", "Can load extender." : @LF : strExtender) Break Case 1 Message ("1|udfExtenderExist", "Extender already loaded." : @LF : strExtender) Break Case 2 Message ("2|udfExtenderExist", "Cannot load extender, all slots are used." : @LF : strExtender) Break EndSwitch If !udfExtenderExist (strExtender) Then AddExtender (strExtender) IntControl (28, 1, 0, 0, 0) IntControl (63, 200, 200, 800, 600) AskItemlist ("List of loaded extender modules", IntControl (77, 42, 0, 0, 0), @TAB, @SORTED, @EXTENDED) Exit ;------------------------------------------------------------------------------------------------------------------------------------------