What is the meaning of the word "vainly"?

Definitions:

  1. In a way that is futile, unsuccessful, or ineffective. copy to clipboard ADVERB
    • He searched vainly for a way out of the maze. copy to clipboard
  2. In a way that shows excessive pride in one's appearance or achievements. copy to clipboard ADVERB
    • He glanced vainly at his reflection in every window. copy to clipboard

Synonyms: