  The solutions of a large class of hierarchies of zero-curvature equations
that includes Toda and KdV type hierarchies are investigated. All these
hierarchies are constructed from affine (twisted or untwisted) Kac-Moody
algebras~$\ggg$. Their common feature is that they have some special ``vacuum
solutions'' corresponding to Lax operators lying in some abelian (up to the
central term) subalgebra of~$\ggg$; in some interesting cases such subalgebras
are of the Heisenberg type. Using the dressing transformation method, the
solutions in the orbit of those vacuum solutions are constructed in a uniform
way. Then, the generalized tau-functions for those hierarchies are defined as
an alternative set of variables corresponding to certain matrix elements
evaluated in the integrable highest-weight representations of~$\ggg$. Such
definition of tau-functions applies for any level of the representation, and it
is independent of its realization (vertex operator or not). The particular
important cases of generalized mKdV and KdV hierarchies as well as the abelian
and non abelian affine Toda theories are discussed in detail.
