Jump to content

Search the Community

Showing results for tags 'dll dllopen'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. Here is a small function that I use if I need to open a DLL, but it could be in any one of several locations on the target PC. You can pass an explicit path as a string variable, or pass an array of strings with multiple paths to check. It will scan through the array, until it is successfully able to open the DLL then returns the handle. ; #INTERNAL_USE_ONLY# =========================================================================================================== ; Name ..........: __DllFindOpen ; Description ...: ; Syntax ........: __DllFindOpen($sDllName[, $vSearchPath = @scriptdir]) ; Parameters ....: $sDllName - dll file to open ; $vSearchPath - [optional] A string with an explicit path to the DLL, or an 1 dimentional array of ; paths to search ; Return values .: Success: Returns a dll "handle" to be used with subsequent Dll functions ; Failure: Returns "" and sets @error ; -1: dll not found or could not open ; -2: $vSearchPath has more than 1 dimension ; -3: $vSearchPath is an improper variable type ; Author ........: David Williams (willichan) ; Modified ......: ; Remarks .......: ; Related .......: DllOpen ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func __DllFindOpen($sDllName, $vSearchPath = Default) Local $hResult, $i If $vSearchPath = Default Then $vSearchPath = @ScriptDir If IsString($vSearchPath) Then ;This is easy. Just one path to look at If StringRight($vSearchPath, 1) <> "\" Then $vSearchPath &= "\" $hResult = DllOpen($vSearchPath & $sDllName) If $hResult = -1 Then SetError(-1, 0, "") ;dll not found or could not open Else Return $hResult EndIf ElseIf IsArray($vSearchPath) Then ;Search the array for the DLL If UBound($vSearchPath, 0) > 1 Then SetError(-2, 0, "") ;too many dimentions in array For $i = 0 To UBound($vSearchPath) - 1 If ($vSearchPath[$i] = Default) Or IsString($vSearchPath[$i]) Then ;only try the strings or Default. Don't want to get into deep recursion. $hResult = __DllFindOpen($sDllName, $vSearchPath[$i]) If @error = 0 Then Return $hResult EndIf Next SetError(-1, 0, "") ;didn't find it Else ;Some dummy wants to see how dummy-proof this is SetError(-3, 0, "") ;not a string or array EndIf EndFunc ;==>__DllFindOpen
×
×
  • Create New...