Jump to content

DllCall BDE IDAPI32.DLL DbiGetCurrSession


primax
 Share

Recommended Posts

Sorry for my english,

I use ADO Provider=Microsoft.Jet.OLEDB.4.0; for access to paradox table but my problem is when a file lock the table.

I want to get current session dir of the session

the way is to call with idapi32.dll

i found this for set the directory

Const
    sesNETFILE           =     131074 ;// &H00020002 rw pCHAR, Full filename of netfile (MAXPATHLEN)
    DBIERR_NOTSUPPORTED  =      12289 ;// (ERRBASE_CAPABILITY + RRCODE_NOTSUPPORTED)   12288 + 1
    DBIERR_INVALIDPARAM  =       9986 ;// (ERRBASE_INVALIDREQ + RRCODE_INVALIDPARAM)    9984 + 2
    DBIERR_NONE          =          0 ;// (ERRBASE_NONE + ERRCODE_NONE)  + 0
    DBIERR_NOTAVAILABLE  = 1541417985
    endConst

    Uses "idapi32.dll"
    DbiGetCurrSession(lphSes cPtr) cLong [stdcall]
    DbiSetProp(lihObj cLong, liProp cLong, iPropValue cPtr) cLong [stdcall]
    endUses

    Proc cmSetNetDir(stNetDir String, var stReturn string) Logical
    ;---------------------->
    Var
    liRetVal,
    liSes        longInt
    endVar
    liRetVal = DbiGetCurrSession(liSes)
    if not liRetVal.isassigned() then
    stReturn="Invalid directory used to set \"Net Control Directory\"."
    return False
    endif
    liRetVal = DbiSetProp(liSes, sesNETFILE, stNetDir)
    if not liRetVal.isassigned() then
    stReturn="Invalid directory used to set \"Net Control Directory\"."
    return False
    endif
    Switch
    Case liRetVal = DBIERR_NONE         :
    stReturn="no error"
    return True
    Case liRetVal = DBIERR_NOTAVAILABLE :
    stReturn="Network isn't available.  Please notify the administrator."
    return False
    Case liRetVal = DBIERR_INVALIDPARAM :
    stReturn="Invalid Parameter used to set \"Net Control Directory\"."
    return False
    Case liRetVal = DBIERR_NOTSUPPORTED :
    stReturn="Not Supported... Change \"Net Control Directory\"."
    return False
    otherwise                           :
    stReturn="Unforeseen Error setting Network Directory.\n\nError Code is
    "+string(liRetVal)
    return False
    endSwitch
    endProc

    method run(var eventInfo Event)
    var
    stNewDir        string
    stReturn        string
    endvar

    stNewDir="c:\\"
    if not cmSetNetDir(stNewDir,stReturn) then
    errorshow(stReturn)
    endif

links to the code in delphi here

please tell me the way or the test to do

thanks

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...