We study, using general scaling arguments and mean-field type calculations, the behavior of the critical Casimir force and its interplay with the van der Waals force acting between two parallel slabs separated at a distance L from each other, confining some fluctuating fluid medium, say a nonpolar one-component fluid or a binary liquid mixture. The surfaces of the slabs are coated by thin layers exerting strong preference to the liquid phase of the fluid, or one of the components of the mixture, modeled by strong adsorbing local surface potentials ensuring the so-called (+,+) boundary conditions. The slabs, on the other hand, influence the fluid by long-range competing dispersion potentials, which represent irrelevant interactions in renormalization-group sense. Under such conditions, one usually expects attractive Casimir force governed by universal scaling function, pertinent to the extraordinary surface universality class of Ising type systems, to which the dispersion potentials provide only corrections to scaling. We demonstrate, however, that below a given threshold thickness of the system L(crit) for a suitable set of slabs-fluid and fluid-fluid coupling parameters the competition between the effects due to the coatings and the slabs can result in sign change of the Casimir force acting between the surfaces confining the fluid when one changes the temperature T, the chemical potential of the fluid μ, or L. The last implies that by choosing specific materials for the slabs, coatings, and the fluid for L≲L(crit) one can realize repulsive Casimir force with nonuniversal behavior which, upon increasing L, gradually turns into an attractive one described by a universal scaling function, depending only on the relevant scaling fields related to the temperature and the excess chemical potential, for L≫L(crit). We present arguments and relevant data for specific substances in support of the experimental feasibility of the predicted behavior of the force. It can be of interest, e.g., for designing nanodevices and for governing behavior of objects, say colloidal particles, at small distances. We formulate the corresponding criterion for determination of L(crit). The universality is regained for L≫L(crit). We also show that for systems with L≲L(crit), the capillary condensation phase diagram suffers modifications which one does not observe in systems with purely short-ranged interactions.