The function
selection
returns the contents of the primary selection as a string, or
nil
if there is no selection.
On Windows there is no notion of selection, so this mechanism is internal to Lisp.
Note that X applications may or may not use the primary selection for their paste operations. For instance, Emacs is configurable by the variable interprogram-paste-function
.