| Newsgroups |
gmane.comp.lang.delphi.jedi |
| Message-ID |
<[email protected]> |
s_david77 wrote:
>Hallo,
Hey!
>First of all I do not how to traslate the WINAPI
>Calling convention for the Win32 API.
WINAPI = stdcall
>#pragma once
Dunno
>// #include <windows.h>
>#include <string.h>
>#include <stdio.h>
>#include <stdlib.h>
>#include <malloc.h>
>#include <time.h>
>#include <conio.h>
>#include <windowsx.h>
>#include <afxwin.h>
These are the includes, very similar to Delphi units.
The equivalent of String.h is already included in System.pas
which is in turn automatically included in Delphi apps.
Malloc and time follow the same fate.
StdIO and ConIO sound referring to a console mode application.
>#define MAX_THREAD 10
This is a sort of "design-time constant".
Use a constant and everybody will be happy.
>#define DllImport __declspec( dllimport )
>#define DllExport __declspec( dllexport )
>
>#ifdef __cplusplus
>extern "C" {
>#endif
These lines seem to imply that this module is used in a
DLL project... is this right?
>typedef struct StructInit {
> BOOL enabled;
> int CommPort;
> char *Settings;
>} INIT;
This is a simple record, like this:
Type
StructInit = record
Enabled : Boolean;
CommPort : Integer;
Settings : PChar;
end;
Init = StructInit;
>typedef void (WINAPI *refreshStatus)(long id, long status);
This is a function template call, like this:
Type
RefreshStatus = procedure( Id : LongInt;Status : LongInt );stdcall;
Or
Type
RefreshStatus = function( Id : LongInt;Status : LongInt ) : Pointer;
stdcall;
>typedef struct StructChip
>{
> int ReadersIndex;
> int nargs;
> char **params;
The hard part here is the double *: it gets translated as a pointer to
pointer, specifically:
Params : ^PChar;
> refreshStatus ptrFunc;
And this is like:
PtrFunc : RefreshStatus;
>int DllExport WINAPI Set_Enviroment(int NP, INIT *mSettings, char *
>InitString);
>int DllExport WINAPI Close_Enviroment(void);
>int DllExport WINAPI Card_Perso(CHIPINF ChipPers);
>int DllExport WINAPI Card_Read(char *CardCode, int size, int
>ReaderIndex, refreshStatus ptrFunc);
>int DllExport WINAPI Card_Test(CHIPINF ChipPers);
>int DllExport WINAPI Lib_Version(char * CardCode, int size);
These are simple exports, you ain't care too much of them.
Plus, importing them is very easy.
HTH,
Andrew
To unsubscribe from this group, send an email to:
[email protected]
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/i7folB/TM
---------------------------------------------------------------------~->
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/Delphi-JEDI/
To unsubscribe from this group, send an email to:
[email protected]
Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/