I am trying to check my path to applications, and if this is not a given path, move it. I feel that my code is solid, but it does not work correctly.
TCHAR pCheck[MAX_PATH]; TCHAR xPath[MAX_PATH]; GetModuleFileName(NULL,xPath,MAX_PATH); if(SHGetSpecialFolderPath(HWND_DESKTOP, pCheck, CSIDL_DESKTOP, FALSE)){ wcscat(pCheck,L"\\NewFile.exe"); MessageBox(NULL,pCheck,NULL,NULL); MessageBox(NULL,xPath,NULL,NULL); if(pCheck!=xPath){ CopyFile(xPath,pCheck,0); ShellExecute(0,L"open",pCheck,NULL,NULL,SW_SHOW); return 0; }else{ MessageBox(NULL,L"New Location",NULL,NULL); return 0; } }
Even if the file is in a new path, it will still have the value pCheck! = XPath
I never get the "New Location" message. When the first two message boxes are displayed, the path is ...
source share