In InnoSetup below is the code used to detect the Next button events,
function NextButtonClick(CurPageID: Integer): Boolean; begin case CurPageID of wpL