/ Forside / Teknologi / Udvikling / Delphi/Pascal / Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
Delphi/Pascal
#NavnPoint
oldwiking 603
jrossing 525
rpje 520
EXTERMINA.. 500
gandalf 460
gubi 270
DJ_Puden 250
PARKENSS 230
technet 210
10  jdjespers.. 200
help wanted
Fra : Herr der Fliegen


Dato : 18-01-01 22:33

I'm new in using Turbo Pascal and I want to use external functions
from a library. So all docs and tutz i found said that this code below
is correct, but it won't work in turbo pascal 7.0
So is there anybody who can correct this code syntax ?
thx

--------8<-------------------------------------------------------
program test;
var Buffer : String;
ret : integer;

function GetWindowsDirectory(lpBuffer : String; nSize : LongInt) : LongInt;
far; external 'KERNEL32.DLL' name 'GetWindowsDirectoryA';

begin
ret := GetWindowsDirectory(Buffer,11);
WriteLn(Buffer); ReadLn;
end.
--------8<-------------------------------------------------------




 
 
Niels (niLLer) (18-01-2001)
Kommentar
Fra : Niels (niLLer)


Dato : 18-01-01 22:55

Just as I expected, "Herr der Fliegen" <lordoftheflies666@gmx.net>
came up with this:

>but it won't work in turbo pascal 7.0

>function GetWindowsDirectory(lpBuffer : String; nSize : LongInt) : LongInt;
>far; external 'KERNEL32.DLL' name 'GetWindowsDirectoryA';

As far as I can see, this is the problem. TP7 is a 16 bit dos/win
compiler, but you are trying to call a function in a 32 bit dll, that
will never work. Try changing 'KERNEL32.DLL' to 'KERNEL.DLL', or maybe
'KERNEL386.EXE'. That _might_ work.

Niels (aka. niLLer)
--
e-mail: nmartin at iname dot com ICQ UIN: 50187323
http://xoasis.com/~niller/ - niLLer's pages (My programs, in English)
http://whitehat.dk/g4s/ - The G4S Page (Personlig side, på dansk)
-- I've been Windozed!

Søg
Reklame
Statistik
Spørgsmål : 177501
Tips : 31968
Nyheder : 719565
Indlæg : 6408526
Brugere : 218887

Månedens bedste
Årets bedste
Sidste års bedste