Jump to content

Help me understand Dll call


Rizzet
 Share

Recommended Posts

hi i need to see when a file is used.. and i found a dll function that probably do what i want, its in dl shell32 file named "SignalFileOpen"

i dont realy now how to get it to work.. i did this and hope some1 could help me little with it

While 1
    Sleep(100)
    Select 
        case DllCall("shell32.dll","none","SignalFileOpen", "str", "504881.wav")
            MsgBox(0, "test","works")
            Exit
    EndSelect
WEnd

the SignalFileOpen has a true/false return value

Link to comment
Share on other sites

did a new script but i still cant get it to work

While 1
    Sleep(10)
    $test = DllCall("C:\WINDOWS\system32\shell32.dll","none","SignalFileOpen", "str", "C:\Sound\504881.wav")
    if $test = true then
            Exit
    EndIf
WEnd

If someone know a better dll file for this or if this is totaly wrong plz tell me :whistle: i would realy like to get this done

Edited by Rizzet
Link to comment
Share on other sites

did a new script but i still cant get it to work

While 1
    Sleep(10)
    $test = DllCall("C:\WINDOWS\system32\shell32.dll","none","SignalFileOpen", "str", "C:\Sound\504881.wav")
    if $test = true then
            Exit
    EndIf
WEnd

If someone know a better dll file for this or if this is totaly wrong plz tell me :whistle: i would realy like to get this done

Totally wrong. :) SignalFileOpen is used to notify the Shell that a file has been opened. And the paramater that is passed to it is not a string, it's a pointer to an item identifier list (PIDL).

If you want to monitor files in a directory, you can take a look at the ReadDirectoryChangesW API.

Auto3Lib: A library of over 1200 functions for AutoIt
Link to comment
Share on other sites

No i think i got right.. i want to know when an other program is using a specifik file.. opening it.. and i tryed PIDL but i still cant get it to work.. if someone could give me an example if an Function that works on the same way i would be vary thankfull

ps: Sry for my bad english, i cant realy explain what i want.

Edit: a does my script tell the shell that the file has been opened? ok and i want to know..so with this dll call im not doing anything:(

Edited by Rizzet
Link to comment
Share on other sites

Yes i have now been looking into

BOOL ReadDirectoryChangesW(
  HANDLE hDirectory,
  LPVOID lpBuffer,
  DWORD nBufferLength,
  BOOL bWatchSubtree,
  DWORD dwNotifyFilter,
  LPDWORD lpBytesReturned,
  LPOVERLAPPED lpOverlapped,
  LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
);

and got this code

Dim $str1
    Dim $str2

    $str1="504881.wav"
    $str2=''

    $res = DllCall("Kernel32.dll", "int", "ReadDirectoryChangesW","none", $str1, "ptr", $str2)
    MsgBox(0, "", "error: " & @error & @CRLF _
                & "res: " & $res & @CRLF)

with this new script i dont get dllcall error, now i just dont get an arrey on the $res and still an @error = 2

and sry for the $str1,$str2 etc when its not a string.. its mostly a copy to test it

Edited by Rizzet
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...