Solved

Win Api

Posted on 1997-04-17
4
147 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: 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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

734 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