Solved

how to find Windows dir?

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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi cmd execution 6 60
Printing problem 2 93
delphi parse string to params 3 123
Embarcadero C++ builder XE10.1 Berlin find In files dialogue stunted display 4 32
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…
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…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
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 …

777 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