Wheellocks were invented around 1500 and were the successor to the matchlock. Like any muzzleloader, gun powder was placed in the muzzle followed by a bullet which was tamped into place. A small amount of powder was placed in a flash pan next to a firing hole that lead into the powder in the barrel.
The wheel seen above on the side of the gun was spring loaded and was wound with a wrench to tighten the spring and lock it in place. This external wheel was attached to a smaller wheel inside the gun.When the trigger was pulled, the tensioned wheels would spin, with the internal wheel scraping against a piece of pyrite that was attached to the "dog"- the dog is shown in the above picture standing upright in the "safe" position, and, yes, it does look more like a duck than a dog. When ready to be fired, the dog was lowered, presenting the pyrite to the small metal wheel. Again, pulling the trigger resulted in the metal wheel spinning and scraping against the pyrite on the dog, generating sparks, igniting the powder in the flash pan and in turn igniting the powder in the barrel of the gun.
Go here for more information about early gun actions.