To trap children in a room, I put a statue in the room, then make the statue into a room. The kid goes in to admire the statue, and I lock the door into the room. I then have someone wall over the door, so the kid can't get out even after he destroys the door when he's a were.
To trap the adult, same method, or perhaps his bedroom or an office or some other workspace, or just put him in his own military unit and station him in the room. Then lock the door, and wall over the door. Presto, trapped dorf who can never get out.
If you have injured, assign a hospital with a door. When they're all in, lock the door, and wall in the hospital, then assign a new hospital for any who might be injured in a more mundane fashion (such as stubbing their toe when they're puking from sunlight exposure, to name a common example). I had a weregiraffe locked in a former hospital for years once. It helped, because every time the fort died (there was a weird thing happening with mass drowning suicides in that fort) it wasn't over, as he was alive and locked up until the next migrant wave arrived. So now I don't bother to kill the werebeasts. They're fine locked up.
I've never needed to use dwarfhack to solve this problem. Generally if I'm suspicious someone is a were, I trap them in a walled off room till I find out, then I can always deconstruct the wall later. After a particularly nasty weretortoise attack, I locked every dwarf in a different bit of the fort, waited a month, then watched the weres deconstruct their own doors and roam free. Each who did this got assigned to a unit, and later got put in the same room together. Then I just deconstructed the walls on the ones not infected, and they walled in their were-beast friends.