Solved

how to find Windows dir?

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
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…

708 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

16 Experts available now in Live!

Get 1:1 Help Now