A problem occurred in a recent program. When the select file dialog box is opened, the Log Module reports an I/O error and checks it online,
I am not familiar with the underlying mechanism of Windows because of problems caused by the use of the relative path in http://bbs.csdn.net/topics/290069179:
1. if setcurrentdirectory is not actively called, the current path is the initial path specified when the process starts, this path is not necessarily the directory where the main program of the process is located (For details, refer to the eighth parameter in CreateProcess );
2. Generally, the dialog is set to modify the current path. Therefore, when you choose to confirm, the current path will be changed to the (selected) path shown on the dialog.
Generally speaking, using this uncertain relative path is very insecure. Any execution unit may adjust the current path by explicitly or implicitly calling setcurrentdirectory, A better way is to obtain a specific relative path (including the current application, current user, and so on) by using the environment variable or getmodulefilename, and then calculate it.