Use the shell API to find the specified suffix file name in this machine's registration program

xiaoxiao2021-03-06  37

CSTRING CBASEUTIL :: FINDEXEPROG (LPCTSTR LPSZPOSTFIX) {IF (lpszpostfix) == 0) Return_T (""); if (lstrcmpi (lpszpostfix, _t ("exe") == 0) Return_t (") ; TCHAR szResult [MAX_PATH]; TCHAR szTempPath [MAX_PATH]; TCHAR szTempName [MAX_PATH]; GetTempPath (MAX_PATH, szTempPath); GetTempFileName (szTempPath, _T ( "."), 0, szTempName); lstrcat (szTempName, _T ( "" )); Lstrcat (sztempname, lpszpostfix);

HANDLE hTempFile = CreateFile ((LPTSTR) szTempName, GENERIC_READ, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (hTempFile == INVALID_HANDLE_VALUE) return _T ( ""); CloseHandle (hTempFile); FindExecutable (szTempName, szTempPath, szResult) Deletefile (sztempname); returnif (szResult);

转载请注明原文地址:https://www.9cbs.com/read-60644.html

New Post(0)