Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2003-02

Linking to Windows

16 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Hans Mårtensson

According to the Free Pascal Programmers manual chapter 4.1 it is possible to specify an external Windows function with:
Procedure ProcName(Args: TProcArgs); external 'Name' index SomeIndex

But where can I get information on which function has which index in which DLL?

Hans M.

Reply by email

Anton Tichawa
to Hans Mårtensson

Hello, List!

you wrote 6 lines
According to the Free Pascal Programmers manual chapter 4.1 it is possible to specify an external Windows function with: Procedure ProcName(Args: TProcArgs); external 'Name' index SomeIndex But where can I get information on which function has which index in which DLL?

Just try without the "index SomeIndex". I think you don't even need the <Name> if it matches the pascal name. But I'm almost sure it will work without mentioning the index.

If you really need indices, you might find them in microsoft's (API?) documentation.

Hope this helps,

Anton Tichawa.

----------

"Adas Methode war, wie sich zeigen wird, Tagträume in offenbar korrekte Berechnungen einzuweben."

Doris Langley Moore: Ada, Countess of Lovelace (London 1977).

----------

Anton Tichawa
Volkertstrasse 19 / 20
A-1020 Wien
mobil: +43 664 52 07 907
email:

----------

Reply by email

Anton Tichawa
to Hans Mårtensson: According to the Free Pascal Programmers manual chapter 4.1 it is possible to specify an…

Hello, List!

.. and I remember some sort of 'DLL viewer', or 'Quick View', at least in winnt (or Windows Commander?), that showed dll porperties, including procedure names and indices .. it's difficult to work with indices, isn't it?

Anton Tichawa.

----------

"Adas Methode war, wie sich zeigen wird, Tagträume in offenbar korrekte Berechnungen einzuweben."

Doris Langley Moore: Ada, Countess of Lovelace (London 1977).

----------

Anton Tichawa
Volkertstrasse 19 / 20
A-1020 Wien
mobil: +43 664 52 07 907
email:

----------

Reply by email

Hans Mårtensson
to Anton Tichawa: Hello, List! Just try without the "index SomeIndex". I think you don't even need the…
you wrote 15 lines
Hello, List! On Monday 03 February 2003 21:14, you wrote: > According to the Free Pascal Programmers manual chapter 4.1 it is possible > to specify an external Windows function with: > Procedure ProcName(Args: TProcArgs); external 'Name' index SomeIndex > > But where can I get information on which function has which index in which > DLL? Just try without the "index SomeIndex". I think you don't even need the <Name> if it matches the pascal name. But I'm almost sure it will work without mentioning the index.

That sounds simple ... problem is that it doesn't work that way. If I omit 'Name' I get a linking error.
If I put in some 'Name', I get the run time error: Missing Name.DLL. So it looks like there has to be the reference to the correct DLL file.

If you really need indices, you might find them in microsoft's (API?) documentation.

I hoped so, but I cannot find them in Microsoft's home page.

Hans M.

Reply by email

Unknown author
to Hans Mårtensson

In , on 02/04/03
at 11:18 PM, Hans Mårtensson said:

Show quoted text 7 lines
>If you really need indices, you might find them in microsoft's (API?) >documentation. > I hoped so, but I cannot find them in Microsoft's home page. Hans M.

You can get the SDK help files from Borland:

ftp://ftp.borland.com/pub/delphi/techpubs/delphi3/d3ms.zip

Be warned, this is a 15M download.

Rolf Grunsky

----------------------------------------------------------------- Truth in her dress finds facts too tight In fiction she moves with ease. Rabinranath Tagore -----------------------------------------------------------------

Reply by email

Anton Tichawa
to Hans Mårtensson: That sounds simple ... problem is that it doesn't work that way. If I omit 'Name' I get a…

hello,

please post the 'uses' clauses and the function declaration from your source. that should make it easier.

anton.

----------

"Adas Methode war, wie sich zeigen wird, Tagträume in offenbar korrekte Berechnungen einzuweben."

Doris Langley Moore: Ada, Countess of Lovelace (London 1977).

----------

Anton Tichawa
Volkertstrasse 19 / 20
A-1020 Wien
mobil: +43 664 52 07 907
email:

----------

Reply by email

Anton Tichawa
to Hans Mårtensson: That sounds simple ... problem is that it doesn't work that way. If I omit 'Name' I get a…

wait some minutes ..

anton.

Show quoted text 30 lines
At 05:46 04-02-2003 +0100, you wrote: >Hello, List! > >On Monday 03 February 2003 21:14, you wrote: >> According to the Free Pascal Programmers manual chapter 4.1 it is >> possible to specify an external Windows function with: >> Procedure ProcName(Args: TProcArgs); external 'Name' index SomeIndex >> >> But where can I get information on which function has which index in >> which DLL? > >Just try without the "index SomeIndex". I think you don't even need the ><Name> if it matches the pascal name. But I'm almost sure it will work >without mentioning the index. That sounds simple ... problem is that it doesn't work that way. If I omit 'Name' I get a linking error. If I put in some 'Name', I get the run time error: Missing Name.DLL. So it looks like there has to be the reference to the correct DLL file. >If you really need indices, you might find them in microsoft's (API?) >documentation. I hoped so, but I cannot find them in Microsoft's home page. Hans M. _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
---------- "Adas Methode war, wie sich zeigen wird, Tagträume in offenbar korrekte Berechnungen einzuweben." Doris Langley Moore: Ada, Countess of Lovelace (London 1977). ---------- Anton Tichawa Volkertstrasse 19 / 20 A-1020 Wien mobil: +43 664 52 07 907 email: ----------

Reply by email

Anton Tichawa
to Anton Tichawa

On Wednesday 05 February 2003 03:50, you wrote:

nothing found yet. may be half an hour work.

Show quoted text 32 lines
anton. > At 05:46 04-02-2003 +0100, you wrote: > >Hello, List! > > > >On Monday 03 February 2003 21:14, you wrote: > >> According to the Free Pascal Programmers manual chapter 4.1 it is > >> possible to specify an external Windows function with: > >> Procedure ProcName(Args: TProcArgs); external 'Name' index SomeIndex > >> > >> But where can I get information on which function has which index in > >> which DLL? > > > >Just try without the "index SomeIndex". I think you don't even need the > ><Name> if it matches the pascal name. But I'm almost sure it will work > >without mentioning the index. > > That sounds simple ... problem is that it doesn't work that way. > If I omit 'Name' I get a linking error. > If I put in some 'Name', I get the run time error: Missing Name.DLL. > So it looks like there has to be the reference to the correct DLL file. > > >If you really need indices, you might find them in microsoft's (API?) > >documentation. > > I hoped so, but I cannot find them in Microsoft's home page. > > Hans M. > > _______________________________________________ > fpc-pascal maillist - > http://lists.freepascal.org/mailman/listinfo/fpc-pascal
---------- "Adas Methode war, wie sich zeigen wird, Tagträume in offenbar korrekte Berechnungen einzuweben." Doris Langley Moore: Ada, Countess of Lovelace (London 1977). ---------- Anton Tichawa Volkertstrasse 19 / 20 A-1020 Wien mobil: +43 664 52 07 907 email: ----------

Reply by email

Hans Mårtensson
to Unknown author: In , on 02/04/03 at 11:18 PM, Hans Mårtensson said: You can get the SDK help files from…
you wrote 8 lines
You can get the SDK help files from Borland: ftp://ftp.borland.com/pub/delphi/techpubs/delphi3/d3ms.zip Be warned, this is a 15M download. Rolf Grunsky

Thank you for the link, but I have allready got these help files allthough in an older version, and they don't include the information of DLL names and indices.

My problem is that I want to use some win32 functions that are not included in the FreePascal Windows unit, e. g. OpenPrinter or SetPrinter. According to the FreePascal Programmers' manual (ch. 4.1) the easyist way to do this is declaring an external procedure. But then you have to know the name of the DLL and the index where the function resides. The Borland help files have all the information of the win32 functions except in which DLLs they resides.

Hans M.

Reply by email

Hans Mårtensson
to Anton Tichawa: please post the 'uses' clauses and the function declaration from your source. that should…
you wrote
please post the 'uses' clauses and the function declaration from your

source.

that should make it easier. anton.

Here is a test program I have used:

program x_prog;
{$APPTYPE GUI}
uses windows;
var pPrinter: LPHANDLE;
    prd: PRINTER_DEFAULTS;
Procedure OpenPrinter(pPintername: LPSTR; phPrinter: LPHANDLE; pDefault:
PRINTER_DEFAULTS); external;
begin
  OpenPrinter('HP-printer', pPrinter, prd);
end.

This gives linking error during compilation because it has not been defined what to link with. A NAME can be added after the word 'external', but then I need to know the name of the DLL that includes the OpenPrinter function.

Hans M.

Reply by email

Matt D. Emson
function OpenPrinter(pPrinterName: PChar; var phPrinter: THandle; pDefault: PPrinterDefaults): BOOL; stdcall;    external 'winspool.drv' name 'OpenPrinterA';

Will work.

Matt

Show quoted text 38 lines
-----Original Message----- From: On Behalf Of Hans Mårtensson Sent: 05 February 2003 14:58 To: Subject: Re: [fpc-pascal]Linking to Windows At 19:10 04-02-2003 -0500, you wrote: > >You can get the SDK help files from Borland: > >ftp://ftp.borland.com/pub/delphi/techpubs/delphi3/d3ms.zip > >Be warned, this is a 15M download. > >Rolf Grunsky Thank you for the link, but I have allready got these help files allthough in an older version, and they don't include the information of DLL names and indices. My problem is that I want to use some win32 functions that are not included in the FreePascal Windows unit, e. g. OpenPrinter or SetPrinter. According to the FreePascal Programmers' manual (ch. 4.1) the easyist way to do this is declaring an external procedure. But then you have to know the name of the DLL and the index where the function resides. The Borland help files have all the information of the win32 functions except in which DLLs they resides. Hans M. _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/f> pc-pascal

Reply by email

Anton Tichawa
to Hans Mårtensson: Thank you for the link, but I have allready got these help files allthough in an older…

Hello, Hans!

You may use the GetProcAddress (Win32 API function) to retrieve the procedure's START-ADDRESS, wehre the input parameter is EITHER an index, I think of limited size, OR a name, that must be SPELLED CORRECTLY.

If you try both, and look for MATCHING ADDRESSES, you should be able to get all (?) you need.

The function's interface is:

GetProcAddress returns address of specified DLL functions:

FARPROC GetProcAddress(HMODULE hModule, LPCSTR lpProcName);

hModule = handle returned by LoadLibrary or GetModuleHandle

lpProcName

Either hi-word = 0 and lo-word = index; or ASCIIZ string

returns: 0 = error (call GetLastError); else address of DLL function

Hope this Helps.

Anton Tichawa.

you wrote 26 lines
At 19:10 04-02-2003 -0500, you wrote: >You can get the SDK help files from Borland: > >ftp://ftp.borland.com/pub/delphi/techpubs/delphi3/d3ms.zip > >Be warned, this is a 15M download. > >Rolf Grunsky Thank you for the link, but I have allready got these help files allthough in an older version, and they don't include the information of DLL names and indices. My problem is that I want to use some win32 functions that are not included in the FreePascal Windows unit, e. g. OpenPrinter or SetPrinter. According to the FreePascal Programmers' manual (ch. 4.1) the easyist way to do this is declaring an external procedure. But then you have to know the name of the DLL and the index where the function resides. The Borland help files have all the information of the win32 functions except in which DLLs they resides. Hans M. _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
---------- "Adas Methode war, wie sich zeigen wird, Tagträume in offenbar korrekte Berechnungen einzuweben." Doris Langley Moore: Ada, Countess of Lovelace (London 1977). ---------- Anton Tichawa Volkertstrasse 19 / 20 A-1020 Wien mobil: +43 664 52 07 907 email: ----------

Reply by email

Hans Mårtensson
to Anton Tichawa
you wrote 7 lines
You may use the GetProcAddress (Win32 API function) to retrieve the procedure's START-ADDRESS, wehre the input parameter is EITHER an index, I think of limited size, OR a name, that must be SPELLED CORRECTLY. If you try both, and look for MATCHING ADDRESSES, you should be able to get all (?) you need.

<snip>

Show quoted text 6 lines
Hope this Helps. Anton Tichawa.

I've tried this before with poor succes, may be the problem was the point with the correct spelling.
Thank you very much for your help.

Hans M.

Reply by email