The confinement of critical fluctuations in soft media induces critical Casimir forces acting on the confining surfaces. The temperature and geometry dependences of such forces are characterized by universal scaling functions. A novel approach is presented to determine them for films via Monte Carlo simulations of lattice models. The method is based on an integration scheme of free energy differences. Our results for the Ising and the XY universality class compare favourably with corresponding experimental results for wetting layers of classical binary liquid mixtures and of 4He, respectively.