Unscrew any window brackets and pry out the screen and window along with the window mounting bracket.
Insert the pry-bar underneath the molding rubber --- a black or white rubber piece that goes around the entire frame of the window in the housing. Grab a loose piece of the molding and pull the entire rubber piece out from the window.
Push the new molding into the window frame housing and the apply a single coat of the waterproof caulking. Allow it to dry and then place the screen and window back into the housing and screw down any attachment points and brackets.
Unscrew the old latch off the window and the window housing. Set the screws aside and discard the old, broken latch.
Set the new latch pieces on both the window and housing. Align the screw holes and tighten down the latches with the old screws.
Open and close the latch to set it into the screw holes and loosen the mechanism.