Solved

The use of GetWindowsDirectory..

Posted on 1998-01-07
3
188 Views
Last Modified: 2012-08-13
I tried to use it like this...

Procedure Button1.Click...
Var Test:PChar;
    BufferS:Integer;
Begin
   BufferS:=255;
   GetWindowsDirectory(test,BufferS);
   ShowMessage(Test);
End;

However, I get some message like "Access Violation"...
Is there somebody outthere who knows how to use it?
Please give me a syntax example....

Thanx!
Erik N.


0
Comment
Question by:Erik N
  • 2
3 Comments
 

Author Comment

by:Erik N
ID: 1355572
Edited text of question
0
 
LVL 5

Accepted Solution

by:
ronit051397 earned 50 total points
ID: 1355573
procedure TForm1.Button1Click(Sender: TObject);
var A: PChar;
begin
  GetMem(A,MAX_PATH+1);
  GetWindowsDirectory(A,MAX_PATH+1);
  showmessage(StrPas(A));
  FreeMem(A,MAX_PATH+1);
end;
0
 

Author Comment

by:Erik N
ID: 1355574
Thank you for this, ronit!
Erik N.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

679 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