Apparently, those arguments (wparam, lparam) are meant to handle memory addresses, and if so then it was right to change them to the new variable longptr in order to have new PB12.6 applications working correctly whether they are running as 32-bit (4 bytes) or 64 bit (8 bytes).
My concern is why are you passing the "lparam" datawindow event control argument to the the datawindow object retrieve argument? What is it that you are trying to retrieve from the database that needs the lparam argument?
Maybe you should stop using the pbm_customxx Event ID and create a new event without any associated Event ID using the long datatype to pass the argument to the datawindow object without any interference from the compiler.