Private Declare Function


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: Private Declare Function

  1. #1
    Join Date
    Feb 2009
    Posts
    44

    Private Declare Function

    After the "Lib", on Private Declare Function if the .dll isn't in your directory you have to specify where it is. Is there a way to do something like this?

    original
    Code:
    Private Declare Function GetUserAccount Lib "ez.dll" _
    what i want implemented
    Code:
    Private Declare Function GetUserAccount Lib strPath  _
    public sub form_load
    public strPath as string
    strPath = "c:\ez.dll"
    end sub

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    How about putting it in the System directory where the other DLL files live?

    Windows will know where that is.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  3. #3
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    You cannot use a variable in a Declare statement, but you can use the LoadLibrary API to load a DLL from a variable location at runtime, then use Jonathan Woods' CallPtr example to call a function using its address in memory. For an example of using LoadLibrary, see http://www.ex-designz.net/apidetail.asp?api_id=617; you may download CallPtr from here: http://www.softcircuits.com/sw_tools.aspx
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  4. #4
    Join Date
    Feb 2009
    Posts
    44
    Quote Originally Posted by Phil Weber View Post
    You cannot use a variable in a Declare statement, but you can use the LoadLibrary API to load a DLL from a variable location at runtime, then use Jonathan Woods' CallPtr example to call a function using its address in memory. For an example of using LoadLibrary, see http://www.ex-designz.net/apidetail.asp?api_id=617; you may download CallPtr from here: http://www.softcircuits.com/sw_tools.aspx
    so would you call something like this?

    Private Declare Function GetUserAccount Lib "ez.dll" _
    (ByVal ezStr As Any, ByVal ezData As Any, ByVal ezLen As Any, ByVal ezValue As Any, ByRef ezTime As Any) As Long

  5. #5
    Join Date
    Feb 2009
    Posts
    44
    Quote Originally Posted by WeightOver2001 View Post
    so would you call something like this?

    Private Declare Function GetUserAccount Lib "ez.dll" _
    (ByVal ezStr As Any, ByVal ezData As Any, ByVal ezLen As Any, ByVal ezValue As Any, ByRef ezTime As Any) As Long
    Anyone have any ideas how to call it like this with loadlibrary with the parameters?

Similar Threads

  1. display 2 columns in the standard listbox
    By shachar in forum VB Classic
    Replies: 5
    Last Post: 06-22-2002, 02:42 PM
  2. Writing in HKEY_LOCAL_MACHINE...Access is denied
    By Martin in forum VB Classic
    Replies: 22
    Last Post: 12-03-2001, 03:53 AM
  3. AnimateWindow API
    By Tim Manos in forum VB Classic
    Replies: 4
    Last Post: 10-19-2001, 06:06 AM
  4. verify local admin
    By Patrick Comeau in forum VB Classic
    Replies: 6
    Last Post: 03-22-2001, 10:50 PM
  5. Replies: 2
    Last Post: 10-18-2000, 10:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center