Solved

Win Api

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

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month9 days, 2 hours left to enroll

615 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