Solved

Win Api

Posted on 1997-04-17
4
146 Views
Last Modified: 2010-04-04
I get nervous when I want to use WinApi's. I don't know how to call them. What I want to do is translate 8.3 filenames to win95 long filenames and I know I can use GetFullPathName() for it. But how to call it in Delphi??
TIA,
Eric
0
Comment
Question by:Marg
  • 2
  • 2
4 Comments
 

Author Comment

by:Marg
ID: 1335437
Edited text of question
0
 
LVL 2

Expert Comment

by:alona041797
ID: 1335438
All(most) Windows API functions are all defined in delphi units, to find the delphi unit that includes the defention of the API call you want, select QuickInfo in the WinAPI help file and the header file name (i.e. *.h) is the name of the unit.

In your case "GetFullPathName" is declared in "winbase.h" which is "winbase.tpu".

Just add winbase to your uses clause and your problem is solved, call the function just like a regular delphi(pascal) function.

0
 

Author Comment

by:Marg
ID: 1335439
Sorry, I know I can just call the function, The difficulty for me is that I don't know which types to use etc, going from Pchar to string etc.
Can you give an example how to use the function??
Thanks..

0
 
LVL 2

Accepted Solution

by:
alona041797 earned 50 total points
ID: 1335440
The first parameter is a pchar(array) containing the source string, the second is sizeof(dest), the third is another array(pchar) which is empty, the fourth is a pointer to a longint.
i.e.

var
  src,dest: array[byte] of char;
  l: longint;

begin
  strpcopy(param,src); {I think this is the syntax}
  GetFullPathName(src,256,dest,@l);
end;

I think this would help.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
delphi parse string to params 3 151
Delphi and Access based Enumeration 9 77
update joined tables 2 62
SQL Server Express automatically execute SQL or SP 8 27
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 I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…

685 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