Solved

how to find Windows dir?

Posted on 1997-07-22
1
184 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…
A short film showing how OnPage and Connectwise integration works.

930 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

13 Experts available now in Live!

Get 1:1 Help Now