Solved

Declaring DLL functions in WIN98 and WIN2000

Posted on 2002-07-05
9
214 Views
Last Modified: 2010-05-02
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.
0
Comment
Question by:khaledc
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 50 total points
Comment Utility
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?
0
 
LVL 1

Author Comment

by:khaledc
Comment Utility
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.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
Comment Utility
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.
0
 
LVL 1

Author Comment

by:khaledc
Comment Utility
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.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
Comment Utility
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.

CHeers
0
 
LVL 43

Expert Comment

by:TimCottee
Comment Utility
Comment
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.  

0
 
LVL 3

Expert Comment

by:PNJ
Comment Utility
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

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


   
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
Comment Utility
"C" grade!, Why?
0
 
LVL 1

Author Comment

by:khaledc
Comment Utility
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.

Cheers.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now