Declaring DLL functions in WIN98 and WIN2000

Dear All,

I have a module which contains reference to DLL functions and subs. The problem is that my program should be used under WIN98 as well as WIN2000, the problem is the DLL exists in C:\windows\system when it is in WIN98 and C:\WINNT\system32 in WIN2000. I would like to declare the path of the function depending on the version of windows I am using.

Your help is appreciated.
Who is Participating?

Improve company productivity with a Business Account.Sign Up

Guy Hengel [angelIII / a3]Connect With a Mentor Billing EngineerCommented:
You shouldn't define the full path, as windows could be installed anywhere (also on other drives D:, E: etc).
What is your underlying problem?
khaledcAuthor Commented:
I would like to specify the path of the DLL depending on the vesion of windows. I am sure I had seen something similar done before but the problem is that I can't remember the syntax.
Richie_SimonettiIT OperationsCommented:
Not at all, Angel is correct. If you install that dll with an installer, the install program should knows where is located the system directory for each windows version.
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

khaledcAuthor Commented:
What happened if the files do not exist in the system directory, I am aware of the common path specified of windows but I need to have control over the declaration path.
Guy Hengel [angelIII / a3]Billing EngineerCommented:
You simply have to ensure that the dll is in the "PATH" (or in the application folder itself), otherwise you have to use LoadLibrary API, while then you cannot DECLARE the function as such.

TimCotteeHead of Software ServicesCommented:
From: TimCottee  Date: 07/05/2002 07:32AM PST  
If it is in the system folder as described then there is no need to declare the path to it as this is automatically assumed.  

Can you use the API calls to get the Windows & System directories?

   Declare Function GetWindowsDirectory Lib "kernel32" _
      Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, _
      ByVal nSize As Long) As Long
   Declare Function GetSystemDirectory Lib "kernel32" Alias _
      "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long

   Dim sBuffer As String
   Dim iReturn_Value As Long
   sBuffer = String$(200, " ")
   iReturn_Value = GetWindowsDirectory(sBuffer, 200)

Richie_SimonettiIT OperationsCommented:
"C" grade!, Why?
khaledcAuthor Commented:
Simply because you were the first to answer but not quite what I want.. I was aware of the PATH issue and hence nothing was added to my knowledge, I guess "C" in this situation might have been adequate for just taking an effort.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.