Hi,
im kinda new to Win32 programming and im trying to figure out how to either run the default program for a specific file type or to run explorer that starts in the folder where the file is. but i cant seem to get it work...
Code:
hwndList = GetDlgItem(hWnd, LST_SELECT);
nItem = SendMessage(hwndList, LB_GETCURSEL, 0, 0);
i = SendMessage(hwndList, LB_GETITEMDATA, nItem, 0);
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
std::string pathTo = (std::string)Learn[i].strPath;
int Position = pathTo.find_last_of("\\");
pathTo = pathTo.erase(Position + 1, pathTo.length());
CreateProcess(NULL, lstrcat("explorer", (LPTSTR)pathTo.c_str()), NULL, NULL, true, 0, NULL, NULL, &si, &pi);
the Learn[i].strPath is a string with a path like "C:\program files\ab".
thats what i got so far, but it always returns an error: memory could not be read
i would greatly appreciate it if you could help me to solve that or even show me a way how to open files using the default app for it.
thx