It could be done, but AFAIK, the barrels for the 9mm Glocks of the same frame size won't simply drop into the .40SW frames. They are a bit smaller.
Never even heard of someone making a barrel that would do the conversion, and it would make me nervous. Too many chances for screw ups, particularly with the same slide.
_________________________
-IronRaven
When a man dare not speak without malice for fear of giving insult, that is when truth starts to die. Truth is the truest freedom.