In Texas Hold'em you use your two hole cards (the cards face down in your hand) and the five board cards (the cards face up that everyone uses) to make up your best FIVE CARD poker hand.
In your examples:
When both players have 3 of a kind - Say the board is 77432, and you and your opponent both have a 7. You have 78 and he has 79. In that case your hand (the best FIVE CARD poker hand) would be 77784, and his would be 77794, so he would out kick you.
If their were two board cards that were higher than both yours and your opponents other hole card, then you would split the pot with the same five card poker hand. For example, if the board were 67789, and you had 72 and your opponent had 73, both you and your opponents hand would be 77789.
With a flush on the board, same principle. Make your best 5 card hand. If you do not have any of that suit in your hand, then you are just using the board cards for you hand. If you do have one, and it is higher than the lowest card on the board, you will use the card in your hand and not the one on the board.
Example, if the board were 35679 all hearts, and you have no hearts, you have a 35679 flush. If you opponent had the 4 of hearts in his hand, he'll have the 45679 flush, one notch higher than yours.
With two pair, same thing. If you have the same two pair as your opponent, only if you have a higher hole card than is on the board will you be able to out kick your opponent. And vice versa. If their is a card on the board which is higher than both you and your oppoents kicker, then you will split the pot.
Any questions?
Dan