Sens0r
Messages postés35Date d'inscriptionlundi 23 janvier 2006StatutMembreDernière intervention23 mars 2006
-
19 mars 2006 à 13:55
Sens0r
Messages postés35Date d'inscriptionlundi 23 janvier 2006StatutMembreDernière intervention23 mars 2006
-
23 mars 2006 à 07:37
Bonjour,
est-ce que quelqu'un pourrait me montrer dans un exemple comment la fonction 'SHGetFolderPath' fonctione?
julienbornet
Messages postés99Date d'inscriptionjeudi 9 février 2006StatutMembreDernière intervention 2 février 2009 22 mars 2006 à 23:01
Un autre exemple torouver sur le net (c plus clair):
case ID_ID: //your control, menu, and or accelerator id
{ char sz1[512] = "", sz2[512] = "";
//get your app.exe path
GetModuleFileName(NULL, sz1, 512);
strrev(sz1);
char* p = strchr(sz1, '\\');
if(p) //always true, just in case something so weird happened
{ strcpy(sz2, p);
strrev(sz2);
//add path with your_help.chm::/target_to_go.html
//this assuming that your exe path = your help path
strcat(sz2, "help.chm::/intro.html");
//look for hh.exe (hh = HtmlHelp) which located in %WINDIR%
SHGetFolderPath(NULL, CSIDL_WINDOWS, NULL, SHGFP_TYPE_CURRENT, sz1);
strcat(sz1, "[file://hh.exe/ \\hh.exe]");
//shellexecute it
if((int)ShellExecute(NULL, "open", sz1, sz2, NULL, SW_SHOWNORMAL) <= 32)
{ MessageBox(hwnd, "A file is missing, pls reinstall this app", "Error",
MB_ICONERROR | MB_TASKMODAL);
}
}
return 0;
}