Declaring API externs with structures

BlitzMax Forums/BlitzMax Programming/Declaring API externs with structures

I am attempting to call some Win32 API functions which take structures (types). Has anyone had any experience with this? I haven't been able to get it to work...

SuperStrict

Import "-lkernel32"

Const TH32CS_SNAPPROCESS:Int = 2
Const MAX_PATH:Int = 260

Type PROCESSENTRY32
    Field dwSize:Int
    Field cntUsage:Int
    Field th32ProcessID:Int
    Field th32DefaultHeapID:Int
    Field th32ModuleID:Int
    Field cntThreads:Int
    Field th32ParentProcessID:Int
    Field pcPriClassBase:Int
    Field dwFlags:Int
    Field szExeFile:String
End Type  

Extern "Win32"
	Function WinExec(lpCmdLine:Byte Ptr,nCmdShow:Int)="WinExec@8"
	Function CreateToolhelp32Snapshot:Int(lFlags:Int, lProcessID:Int)
	Function ProcessFirst(hSnapShot:Int, uProcess:PROCESSENTRY32 Ptr)
	Function ProcessNext(hSnapShot:Int, uProcess:PROCESSENTRY32 Ptr)
	Function CloseHandle(hPass:Int)
End Extern


Error:

Compile Error: Illegal pointer type
[Projects/max/dllp/process_list.bmx;24;2]
Build Error: failed to compile Projects/max/dllp/process_list.bmx
Process complete


I also tried declaring ProcessFirst and ProcessNext with integers as their second argument, which obviously doesn't work either.