Recently, a small thing to control the file saving dialog for another program, the purpose is to allow it to save to the location I specified,: p, I want to control the saved data. We know that CFILEDIALOG is easy to set the initial browsing path of the dialog, as long as you change lpstrinitialdir with your own directory in the OpenFileName structure of the CFiledialog class: cfiledialog dlg; dlg.m_ofn.lpstrinitialDir = "c: // windows"; / / Set the browsing directory DLG.Domodal () here, but I want to control a dialog that has already been displayed, this time there is no effect with m_ofn.lpstrinitialdir! I found the handle of this dialog, CWND * PWND = FindWindow via FindWindow, "Save As"); if (PWND) {.... // How to change here? } The most thoughtful way is to use the hook intercept dialog to open the message, change his ink path before he displayed. Oh, I don't want to be so troublesome, and I have time to try again. Later, a relatively convenient way. In actual operation, if we enter a directory name in that file name editing box, then press the OK button, that dialog is not closed, but to switch to that new directory. With this method, we can change the browsing directory of the dialog. The specific steps are as follows: 1. First save the value of that filename editing box, set new directory names 3 in that editing box, the analog mouse click the "OK" button, this time the dialog is switched to the new directory 4, restore The value of the original edit box is also a matter of concern here that the second step is set to send a WM_SETTEXT message without using the setWindowText function, because it has problems when using the process, there is no effect.