[fpc-pascal] C API call problem under WinCE
Gabor Boros
gaborboros at yahoo.com
Mon Nov 6 17:20:56 CET 2006
Hi,
If I start the test application on the WinCE device the result is:
"project1.exe is not a valid Windows CE application."
If I comment out the SCAN_FindFirst call, the application run properly.
See below for the C header, and the test app.
Any suggestions?
Many Thanks!
Gabor
The C header file:
typedef struct tagSTRUCT_INFO
{
DWORD dwAllocated;
DWORD dwUsed;
} STRUCT_INFO;
typedef struct tagSCAN_FINDINFO
{
STRUCT_INFO StructInfo;
TCHAR szDeviceName[MAX_DEVICE_NAME];
TCHAR szPortName[MAX_DEVICE_NAME];
TCHAR szFriendlyName[MAX_PATH];
TCHAR szRegistryBasePath[MAX_PATH];
} SCAN_FINDINFO;
DWORD SCAN_FindFirst(LPSCAN_FINDINFO lpScanFindInfo,LPHANDLE lphFindHandle);
The test application:
program test;
{$apptype console}
uses Windows;
const
E_SCN_SUCCESS=0;
MAX_DEVICE_NAME=6;
{$IFDEF FPC}
{$PACKRECORDS C}
{$ENDIF}
type
tagSTRUCT_INFO = record
dwAllocated : DWORD;
dwUsed : DWORD;
end;
STRUCT_INFO = tagSTRUCT_INFO;
tagSCAN_FINDINFO = record
StructInfo : STRUCT_INFO;
szDeviceName : array[0..(MAX_DEVICE_NAME)-1] of TCHAR;
szPortName : array[0..(MAX_DEVICE_NAME)-1] of TCHAR;
szFriendlyName : array[0..(MAX_PATH)-1] of TCHAR;
szRegistryBasePath : array[0..(MAX_PATH)-1] of TCHAR;
end;
SCAN_FINDINFO = tagSCAN_FINDINFO;
LPSCAN_FINDINFO = ^SCAN_FINDINFO;
function SCAN_FindFirst(lpScanFindInfo:LPSCAN_FINDINFO;
lphFindHandle:LPHANDLE):DWORD;cdecl;external 'SCNAPI32.DLL';
var
lphFindHandle:LPHANDLE;
lpScanFindInfo:LPSCAN_FINDINFO;
begin
SCAN_FindFirst(lpScanFindInfo,lphFindHandle);
end.
More information about the fpc-pascal
mailing list