Qvae Posted February 1, 2008 Share Posted February 1, 2008 Is there a way to detect if an application is accessing a folder, or specific audio files in that folder in the background(I prefer the first one)? The folder wont "actually" be opened or "exist"...as far as I know, so you can't use any of the windows management functions. Basically I want to detect when this other application plays/accesses a sound; but I believe it would be more practical to monitor if the folder that the sounds are in is accessed. Link to comment Share on other sites More sharing options...
Qvae Posted February 4, 2008 Author Share Posted February 4, 2008 After more digging I came across the below script that attempts to solve my problem, but two problems with it. 1, The way this script operates, is it opens the file first, so when the 3rd party app goes to access the file, this script wont detect that it has been accessed...so it essentiall comes up useless for my needs...unless I'm making a mistake somewhere. 2, This way seems very inifficiant because it will open around 40 files in the background and monitor all of them, that SEEMS like it will take up a lot of resources. Am I wrong in that thinking? I tried modifying and googling to see if I can modify how this dll is called and handled, but didn't really come up with anything. So then now I'm back to see if there is a way to monitor a folder being accessed in the same way, as said in the first post, that seems like it would be more efficiant. The script I found. $a = _RealFileOpen("D:\Daten\Text\UltimateFAQ.cc3") MsgBox(4096,"",$a) _RealFileClose($a) Func _RealFileOpen( $szFile ) Local $GENERIC_READ = 0x80000000 Local $OPEN_EXISTING = 3 Local $FILE_ATTRIBUTE_NORMAL = 0x00000080 Local $RFO_h $RFO_h = DllCall( "kernel32.dll", "hwnd", "CreateFile", _ "str", $szFile, _ "long", $GENERIC_READ, _ "long", 0, _ "ptr", 0, _ "long", $OPEN_EXISTING, _ "long", $FILE_ATTRIBUTE_NORMAL, _ "long", 0 ) Return $RFO_h[0] EndFunc Func _RealFileClose( $hFile ) Local $RFC_r $RFC_r = DllCall( "kernel32.dll", "int", "CloseHandle", _ "hwnd", $hFile ) Return $RFC_r[0] EndFunc Link to comment Share on other sites More sharing options...
Qvae Posted February 5, 2008 Author Share Posted February 5, 2008 I was thinking that folder access monitoring would be pointless because the 3rd party app would only access it for an instant split second and could pass detection in a loop...I may be wrong let me know ( even though no one seems to be responding or cares ). So I'm back to monitoring all the files for access in the main loop...I guess I'll just have to see what the resource weight looks like. But the same problem remains of when the script accesses the file, other apps can't (although I see it is possible to fix that with permissions, but haven't been able to get it correct). Also, if another app access the file the instant the script already has it open, will the script see the access? ...My theory is no because the file is technically open already. Lastly, if all of this fails, is it possible to monitor the 3rd party app for access to the sound card? Anyone????????????????????????????????????? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now