Solved

ISAPI Dll path

Posted on 2002-07-02
3
1,006 Views
Last Modified: 2012-06-27
How can I get the path to an ISAPI dll?

With a CGI You can get the path using ExtractFilePath(ParamStr(0)) which returns something like : c:\inetpub\wwwroot\cgi-bin\ ie the location of the cgi executable

Using the same within an ISAPI dll returns C:\WINNT\System32\ ie not the location of the dll.
0
Comment
Question by:StevenB
3 Comments
 
LVL 8

Accepted Solution

by:
TOndrej earned 100 total points
ID: 7126236
ParamStr(0) returns the file name of the executable used to create the current process. That means that when called from a DLL you get the file name of the .exe that loaded the DLL not the file name of the DLL itself.

Instead you can use GetModuleFileName API:

function GetThisModuleFileName: string;
var
  Buf: array[0..MAX_PATH + 1] of Char;
begin
  SetString(Result, Buf, GetModuleFileName(HInstance, Buf, SizeOf(Buf)));
end;

HTH
TOndrej
0
 
LVL 3

Expert Comment

by:rondi
ID: 7126283
function GetModulePath: string;
const
  ModNamelen = MAX_PATH * 2 + 1;
var
  ModName: PChar;
  fname: string;
begin
  ModName := StrAlloc(ModNameLen);
  GetModuleFileName(HInstance,ModName,ModNameLen);
  Result := ExtractFilePath(StrPas(ModName));
  StrDispose(ModName);
end;
0
 
LVL 4

Author Comment

by:StevenB
ID: 7129160
Thanks both of you, that works great.

sorry rondi, TOndrej just beat you to it :o)
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

808 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