“Under this president and this vice president,” Mr. Pence said, “no one is taking your guns.”

The N.R.A. was hit with a rebuke for its lobbying tactics this month when the Democratic-controlled House approved a revamped Violence Against Women Act that would bar those convicted of abusing, assaulting or stalking a domestic partner from buying guns. Mr. Trump disparaged this and other legislative attempts as a move by Democrats to ensure that “bad guys” keep their guns.

The legislative setback played out as the N.R.A. has endured scrutiny over desperate calls for fund-raising and a rare dirty-laundry lawsuit. Earlier this month, the N.R.A. sued the ad firm Ackerman McQueen, one of its closest contractors and the operator of its media arm and the NRATV channel, of mishandling $40 million that it and its affiliates receive annually from the association.

It has also been named in a lawsuit filed against the Federal Election Commission by the Giffords Law Center to Prevent Gun Violence, which has accused the group of abusing campaign finance laws to funnel money toward Mr. Trump and several other Republicans. (In a statement, the N.R.A. called it a “lawsuit based on a frivolous complaint.”)

“There’s definitely some bad news and the N.R.A. internally is suffering from some major turmoil,” Adam Winkler, a law professor at the University of California, Los Angeles, who specializes in the Second Amendment, said in an interview. “But there’s been some major success with Donald Trump.”

Members of the N.R.A.’s five-million-strong gun rights advocates, who have supported Mr. Trump from his days as a long shot Republican presidential candidate, looked toward his visit as welcome fuel to continue battling well-funded gun control groups and Democrats in the House.

“The president is the most enthusiastic supporter of the Second Amendment that has occupied the White House in recent history,” Jennifer Baker, an N.R.A. spokeswoman, said in an interview.

Ms. Baker added that N.R.A. members have been fervently pro-Trump since the beginning because they understood what was at risk. “Our members are pretty politically astute,” Ms. Baker said. “The Supreme Court was at stake, and in recent history we haven’t had a presidential nominee that was so unabashed and vocal about their support for the Second Amendment and our organization.”