... $odmhandle = AllocMemory( 4 ); # <-- 32 bit DWORD ... # retrieve and store the handle in $odmhandle $odmregisterrc = ODMRegisterApp($odmhandle, ...); # use the value of $odmhandle as 32bit DWORD ApiLink ('odma32.dll', 'INT ODMSelectDoc(DWORD OdmHandle, ...); $odmselectrc = ODMSelectDoc($odmhandle,$docid,$flags);