Today, this feature is used in the project, write it out, if you use the place, directly Ctrl C, huh, huh.
The function is as follows:
bool IsFileLocked (LPCTSTR szFileName) {if (szFileName == NULL) return false; HANDLE ret; ret = CreateFile (szFileName, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (ret == INVALID_HANDLE_VALUE) {return true; } Closehandle (return); Return False;}
'-------------------------------------------' Please indicate the source 'author: Don just fine' E-mail: tanaya@163.com '------------------------------------- --------