Solved

Win Api

Posted on 1997-04-17
4
143 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

743 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

12 Experts available now in Live!

Get 1:1 Help Now