Solved

how to find Windows dir?

Posted on 1997-07-22
1
187 Views
Last Modified: 2010-04-04
I'm using multiple windows dirs (C:\windows, E:\Winnt, F:\Win95US) and use a program which needs to install a picture in their root. my code I use now is as follows;

Image1.Picture.Bitmap.Handle := NViewLibLoad('e:\winnt\800x600.jpg', False);

I tried using this suggested in the help file : NViewLibLoad('<systemroot>\800x600.jpg', False); but this does not work.

how does it work so the program automatically searches the root Windir of the active windows (systemroot).
0
Comment
Question by:hellfire052497
1 Comment
 

Accepted Solution

by:
Greyfire earned 50 total points
ID: 1339488
You can use the GetWindowsDirectory API call to get the current path to the Windows directory.  The <systemroot> label that you are attempting to use appears similiar to some of the directory labels supported by InstallShield and other installation packages.  You can also get the path to the current Windows System directory with the GetSystemDirectory call.

Using these calls are simple with Delphi.  The following code can be used:

Var
  WinDirLen: Integer;
  WinDir: PChar;
Begin
  GetMem(WinDir, 255);
  WinDirLen := GetSystemDirectory(WinDir,255);
  { Process SysDir as required perhaps just to copy to a }
  { for later processing so the memory can be dealloc'ed }
  FreeMem(WinDir);
End;

The Delphi help system contains additional information that will be useful for calling these functions.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Suggested Solutions

Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

829 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