A 'pre-programmed' remote that allows you to enter some code for a particular brand simply has a table of the remote commands in memory and they may or may not work. Manufacturers sometimes change the code for particular functions and/or change the IR protocol the device expects to see and the table in the remote may not match.
For 'learning' commands, it will only work if the remote can recognize the IR protocol and therefore decode the command it was sent so it can store it. Assuming the CD player uses a common IR protocol (like NEC1/NEC2) at a commonly supported frequency (usually between 39 kHz and 43 kHz) then learning should work; if it uses an uncommon frequency or a protocol that the learning remote doesn't recognize, it will not be able to learn the command.
If it doesn't work, you can try a few things:
- Fresh batteries in both remotes.
- Vary the distance between the two when you are learning; usually 1-2 inches works best but you can try closer or further.
- Turn off flourescent lights that may interfere with the IR signal.
- Try just tapping the button on the remote you are learning from instead of holding it down. The caveat to that is that if the command is a repeating type command (like volume up/down) you have to hold the button down so the remote that is trying to capture it can see the whole sequence.
- If the remote being learned from is using a protocol that utilizes 'toggle bits' the learning remote will likely NOT be able to learn the signal.
The solution to all of this junk, as usual, is to buy a universal remote like a Harmony, Home Theater Master, or Pronto that can learn just about anything.