> hast Du mal einen Link?
Müsste ich jetzt auch suchen. Aber warum suchen? Hab den Code gleich mitgeliefert!
> ich kenne den Code jetzt nicht
Kannte ich auch nicht, bis ich ihn geschrieben habe!
Hier mal ein Code. Habe ihn kurz mit der echten DriveLED verglichen, scheint zu funktionieren. Lasst bitte einen Virenscanner nebenbei laufen oder etwas, das Festplattenaktivität hervorruft, dait man den Effekt auch sehen kann!
Egal, ob dieser Code was taugt, er ist nebenbei auch ein schönes Beispiel für die Verwendung von Mutex.
Code: Alles auswählen
; Drive LED by AND51
EnableExplicit
Global mColor=CreateMutex(), laufwerk$="C:\" ; Define your Laufwerk here!
OpenWindow(0, 0, 0, 300, 150, "Drive LED by AND51", #PB_Window_MinimizeGadget|#PB_Window_ScreenCentered)
CreateGadgetList(WindowID(0))
ContainerGadget(0, 140, 20, 20, 20, #PB_Container_Raised)
CloseGadgetList()
TextGadget(#PB_Any, 120, 50, 100, 20, "Your Drive LED")
CheckBoxGadget(1, 105, 100, 120, 20, "Enable acustic signal")
Procedure giveLEDstatus(temp)
Protected hNotification
hNotification=FindFirstChangeNotification_(@laufwerk$, 1, #FILE_NOTIFY_CHANGE_ATTRIBUTES|#FILE_NOTIFY_CHANGE_DIR_NAME|#FILE_NOTIFY_CHANGE_FILE_NAME|#FILE_NOTIFY_CHANGE_LAST_WRITE|#FILE_NOTIFY_CHANGE_SECURITY|#FILE_NOTIFY_CHANGE_SIZE)
Repeat
FindNextChangeNotification_(hNotification)
LockMutex(mColor)
While WaitForSingleObject_(hNotification, 1) = 0
FindNextChangeNotification_(hNotification)
SetGadgetColor(0, #PB_Gadget_BackColor, #Red)
If GetGadgetState(1)
Beep_(1500, 10)
EndIf
Wend
UnlockMutex(mColor)
Delay(10)
ForEver
EndProcedure
CreateThread(@giveLEDstatus(), 0)
Repeat
If TryLockMutex(mColor)
SetGadgetColor(0, #PB_Gadget_BackColor, #White)
UnlockMutex(mColor)
EndIf
Until (GetAsyncKeyState_(#VK_ESCAPE) And GetForegroundWindow_() = WindowID(0)) Or WaitWindowEvent(1) = #PB_Event_CloseWindow
Edit: Sogar an das akustische Signal für Kiffi habe ich gedacht
