  With the H1 detector at the ep collider HERA, D* meson production cross
sections have been measured in deep inelastic scattering with four-momentum
transfers Q^2>2 GeV2 and in photoproduction at energies around W(gamma p)~ 88
GeV and 194 GeV. Next-to-Leading Order QCD calculations are found to describe
the differential cross sections within theoretical and experimental
uncertainties. Using these calculations, the NLO gluon momentum distribution in
the proton, x_g g(x_g), has been extracted in the momentum fraction range
7.5x10^{-4}< x_g <4x10^{-2} at average scales mu^2 =25 to 50 GeV2. The gluon
momentum fraction x_g has been obtained from the measured kinematics of the
scattered electron and the D* meson in the final state. The results compare
well with the gluon distribution obtained from the analysis of scaling
violations of the proton structure function F_2.
