I don't think it was mainly guns. I'd say the shift in military practice, tactics, and recruitment that stripped the knight of his tactical/military role, and made him practically obsolete. It was at this point that being a knight became solely a societal position, a denotation of rank, social etiquette and breeding. From there it was simply a long downward spiral until today, where knighthood it to be born with the right last name, or to make a few good movies or songs.