I made a progress bar for the player and encountered a very serious problem during this period. Now I have recorded it for future study.
The progress bar uses the csliderctrl control. The csliderctrl control belongs to the scroll type and has the concept of page. The POS obtained when you click csliderctrl to locate and play is not prepared. This is because when you click csliderctrl to locate the page, the slider will slide the size of the page to the direction of the mouse, rather than positioning the position of the mouse.
The processing method is to intercept wm_lbuttondown and wm_lbuttonup events in the pretranslatemessage of the parent window.
Based on the coordinates of the parent window, the control coordinates and the mouse coordinates in the message, calculate the slider POs, and setpos slide the slider over.
When Calculating coordinates, you must consider that the channel in csliderctrl has a distance from the border. You must calculate this distance, otherwise POS is not accurate. You can use csliderctrl: getchannelrect to obtain the channel coordinate, and left is the distance.
To avoid page problems, you can discard the csliderctrl control and use cstatic to self-paint. This is a little more complicated.