How are the wings of birds, pterosaurs and bats related to each other?
Here is a discussion of homology and analogy that clearly presents bat and bird wings as an example of analogous organs:

http://amrita.olabs.edu.in/?sub=79&amp;brch=16&amp;sim=132&amp;cnt=1

You are right however that bat, bird and pterosaur wings are homologous in a sense, as they have similar underlying structure and a common evolutionary origin - the front limbs of tetrapods.

One could perhaps say that bat, bird and pterosaur wings are homologous organs as front limbs, but analogous organs as wings.

This page has pictures of the skeletal structure of each:

http://www.ucmp.berkeley.edu/vertebrates/flight/converge.html

As you can see, they are similar front limbs - made of a common set of bones and muscles. But those bones have been arranged into wings in different ways: Pterosaurs have a lengthened pinky finger maintaining a flap of skin that makes up the wing; bats have three lengthened fingers with a flap of skin around them; and birds have small, fused finger bones with the surface of the wing being made up of feathers.

And it is in fact the case that as far as their evolutionary history goes, bat, pterosaur and bird front limbs have a common origin in the front limbs of tetrapods, but have separate independent origins in terms of how those front limbs evolved into wings. Or put another way, the common ancestory of bats, birds and pterosaurs had front limbs, but those front limbs weren't wings.

Compare with the "wings" of flying fish, which does have a common origin with that of birds/bats/pterosaurs: both developed from the pectoral fins of their bony fish common ancestor. Obviously they became wings independently, and they also have a very different evolutionary origin as "limbs". On the other hand when you look at the wings of insects, there is no common origin between those and the wings of vertebrates at all. The common ancestor of insects and vertebrates had no limbs at all, not even bones or an exoskeleton. Both lineages developed limbs and hard support structures independently, and then adapted some of the structures they had for flight.

Interestingly it seems a book recently came out on the flight of bats, birds, pterosaurs and insects: On the Wing: Insects, Pterosaurs, Birds, Bats and the Evolution of Animal Flight by David E. Alexander. It could be an interesting read to anyone interested in the question. Here are some reviews of the book:

http://www.bioone.org/doi/pdf/10.1642/AUK-15-210.1

https://academic.oup.com/icb/article/56/5/1044/2420642

ETA: If you want to bend your mind a bit around the question of homologous vs analogous organs (or homology vis homoplasy), look at these two questions from the sidebar:  

The pectoral fins of a whale and a shark. Are they analogous organs?  

How large is the range of &#39;same origin&#39; when determining whether two organs are analogous or homologous?  

Which ask similar questions you did, but of the fins of whales vs the fins of sharks. And that's a funny one isn't it! Because where in the pterodactyl example we have a common ancestor who had front limbs but didn't have wings, in that case the common ancestor of whales and sharks did have pectoral ("chest-level") fins, that the fins of whales and sharks descend from! So, homologous? But the fins of whales spent so much of their evolutionary history not being fins at all that it does make one want to say the homology is at the "front limb thingy" level not the "fin" level. I mean, as far as evolutionary distance goes, the wings of flying fish and of bats are actually more closely related to each other than the fins of whales and of sharks are!!! (the evolutionary history there goes: jawed fish (Eugnathostomata) -> cartilaginous fish (Chondrichthyes; led to sharks) and bony fish (Osteichthyes; led to flying fish, bats and whales).

99% of the "shark-fin-like" appearance of whale fins developed long, long after their split from the shark lineage; and I don't know what the front fins of the jawed fish common ancestor was like but it's possible it looked different from whale/shark fins too, so the some of the "whale-fin-like" appearance of shark fins may also have developed independently after the split.