To measure 45 minutes, ignite both ends of one fuse and one end of the other. When the first fuse disappears, ignite the remaining end of the second. When the second disappears, 45 minutes have elapsed since the start.
To measure 40 minutes, ignite three flames and maintain three flames until both fuses are gone. 120 minutes worth of fuse divided by three is 40 minutes. Whenever two flames go out together (when a piece of fuse burning from both ends disappears) you must ignite two more to replace them, which you can do by cutting a piece in the middle and igniting both of the new ends (or just ignite the middle, which performs the cut for you). Whenever a single flame goes out (when a piece of fuse burning from one end disappears), you must ignite one end of another piece, which might require first cutting a piece if all pieces are burning from both ends. Notice that a potentially infinite number of operations may be required, so it's especially important that you move infinitely fast.
To measure any fraction n/d of an hour, where 0 < n/d <= 1, maintain d flames on the first fuse and d-n+1 flames on the second. When the first fuse is gone, extinguish all but one of the flames on the second, and maintain one flame. When the second fuse is gone, n/d of an hour has elapsed since the start.