This is a headache and now is the time to start working on it.
As a starting point -- punishing the dog by swatting isn't going to teach him not to bark. Indeed for a lot of dogs saying No to them just encourages the barking as they get a response from you (eg you are rewrading the unwanted behaviour with your attention -- just like children will keep misbehaving as they value your attention more than they care about being punished). As you aren;t showing the dog anything else that he is supposed to be doing, he is just left confused (consider it this way. Imagine you are talking and someone keeps shouting 'no' at you and pushing your shoulder. What would you do? You'd probably be confused -- what is the person objecting to? What do they want you to do? Barking is the way a dog communicates and is as normal as speaking -- he's barking because he is happy and excited and wants you to notice what he's excited about! He also may think he is doing a very good job alerting you to important things. Then you are saying 'no' and discouraging what he sees as his very good doggie behaviour -- and he will have no idea why. Also -- swatting or hitting is really never the way to go especially with this breed, as you truly risk a very anxious or timid or cowed dog. The best approach is to reward the dog for doing what you do want, and giving the dog behaviour options that you do want. Cavaliers respond and learn quickly thru rewards.
With barking the best approach is to distract the dog's attention onto something you do want him to do -- a chew toy, ec, then praise for switching activity. Also you can train 'quiet' -- to do this it is often easier to teach 'speak' first, then 'quiet' as the alternative.
I also don't want to teach my dogs that barking is bad as I want them to be alert to odd noises in the house. So if they all start barking I will say 'thank you, good dogs', and they generally stop -- they do look to you for approaval and once they have it, that's that most of the time. If they start again I say 'enough!' which they know means -- everyone stop and pay attention! But I have had to train this over time.
Of course a good way to control unwanted barking is to remove whatever the stimulus is. So if the dog keeps charging at windows, train the dog to go to a bed and go into a downstay. Once the dog can't race and bark out the window, the hooha is over -- there's nothing to bark at from the bed.
Really, getting the behaviour you want requires your time and patience to learn to read and communicate with your dog, laying down a foundation of good behaviour and training. This means you need to take the time to do a really good, rewards (not correction) based obedience class, work with a trainer, help the dog learn self control and confidence by working with you in class and in daily practice sessions. A dog that can go into a down stay and relax, is a dog that won't be barking.
Lots of good behaviour and training sheets here:
www.deesdogs.com Have a look at the sheet on reactive dogs -- you basically have a dog that is overly reactive to normal events. You can train away from this, as Dee points out.
here is what she suggests totrain away from barking without using harsher corrective methods (that often do not work or stop working):
Each and every time your dog barks, get up, go out, and see why the dog is barking.
If your dog is barking for a good reason (such as a stranger in the yard), you should
praise your dog and then tell it to be quiet. If the stranger is coming to see you I would
give the visitor a treat to give your dog this will prevent your dog from becoming overly
protective. If the dog is barking because there is a squirrel up the tree, or something
similar, tell the dog to be quiet and immediately go back into the house. Bring the dog
with you and make him lie down next to you for 5 minutes. You will have to repeat this
every time the dog barks. Pretty soon, in a week or so depending on the dog, the dog will
only bark for a good reason.
You must reinforce not barking. If you have seen the dog choose not to bark, go play
with him. Jack pot quiet behavior with something he likes. The dog may still bark at the
squirrel, but not continually. Instead, one or two good barks to scare the squirrel, and then
it considers its duty done. At the same time, you have not dampened your dog’s ability to
bark when there is something wrong. Take a neighbor's complaint seriously, even if it is
unwarranted. More neighbor disputes arise over barking dogs than anything else. Dogs
have been injured or killed by neighbors desperate for a good night’s sleep. There is some
evidence that barking is an inherited trait: if the parents bark a lot, chances are their
puppies will too. Also, certain breeds love to bark!
One method that helps alleviate barking is to give your dog permission to bark.
Teach him to "speak" -- let him "speak" when appropriate (say, when you're playing in
the park). Then "quiet". You can put a bit of peanut butter into the dog's mouth and he
will have to stop barking to lick the peanut butter off the roof of his mouth.
Thisis the article on reactive dogs and lowering their arousal levels:
http://www.deesdogs.com/documents/LoweringArousal.pdf